• Login
Community
  • Login

My first user defined language

Scheduled Pinned Locked Moved General Discussion
3 Posts 2 Posters 227 Views
Loading More Posts
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • J
    John Davies
    last edited by John Davies Jun 22, 2021, 1:28 PM Jun 22, 2021, 1:27 PM

    I have a log file that I’d like to create a UDL to highlight the text based on keywords. Before I start on it I’d just like to know if it’s possible. It’s not really a language.

    For example, my log file might look like:

    6/22/2021 3:47 Keylogger Start key pressed
    6/22/2021 3:47 Keylogger Start key released
    6/22/2021 3:49 AlarmLog Battery alarm
    6/22/2021 3:49 AlarmLog Battery alarm reset
    6/22/2021 4:50 EventLog Settings changed

    Say I’d like to have any lines with KeyLogger be light blue text on a black background, AlarmLog Red text on black, and EventLog Black on white. Could I do this with a UDL?

    Thanks,
    John

    P 1 Reply Last reply Jun 22, 2021, 1:46 PM Reply Quote 0
    • P
      PeterJones @John Davies
      last edited by Jun 22, 2021, 1:46 PM

      @John-Davies ,

      The whole line? No. But using “delimiters” instead of keywords, you can highlight from the key (Keylogger, AlarmLog, or EventLog) to the end of the line:

      5f81f462-067c-4f25-84cf-82f95b35c443-image.png

      If that’s not good enough, you can add extra highlighting to a lexer (including UDL lexer) using regexes via the script EnhanceAnyLexer.py that @Ekopalypse shares in his github repo .

      Also, there is a plugin called the “AnalysePlugin ”, which claims “AnalysePlugin will help you to search for more than one search pattern at a time. Great for analysing big log files…” – you can use the Plugins menu Plugins Admin to install that plugin, and see if it works for you.

      1 Reply Last reply Reply Quote 1
      • J
        John Davies
        last edited by Jun 22, 2021, 6:49 PM

        Thank you. That’s a great start.

        1 Reply Last reply Reply Quote 0
        1 out of 3
        • First post
          1/3
          Last post
        The Community of users of the Notepad++ text editor.
        Powered by NodeBB | Contributors