Community
    • Login

    Plugin or UDL to color whole lines by regexp?

    Scheduled Pinned Locked Moved Help wanted · · · – – – · · ·
    3 Posts 2 Posters 665 Views 2 Watching
    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.
    • Yuval KfirY Offline
      Yuval Kfir
      last edited by

      I’m looking for either a Notepad++ plugin, or a User-Defined Language, that will allow me to color lines in a file by regexp.
      E.g. a line containing “ERROR” (anywhere in the line) should be red, and a line containing “code [0-9]+” should be green (the whole line, not just the regexp).

      This appears quite simple (is it though?) yet I haven’t been able to locate any solution. “AnalysePlugin” comes close, but it doesn’t color the file itself but rather displays the lines in a separate window. I want the coloring to be like syntax highlighting.

      Does such a thing exist?
      Thanks in advance!

      PeterJonesP 1 Reply Last reply Reply Quote 0
      • PeterJonesP Online
        PeterJones @Yuval Kfir
        last edited by PeterJones

        @Yuval-Kfir ,

        If by “color lines” you mean you want to change the foreground color, then you could probably use the EnhanceAnyLexer plugin:

        Assuming it’s a Normal text file, you would use Plugins > EnhanceAnyLexer > Enhance Current Language, and the plugin will add a section to its .ini file called [normal text] with an example pair of color (on the left of the equal) and regex (on the right of the equal).

        If you were to enter

        0x0000FF = ^.*ERROR.*$
        0xFF0000 = ^.*code [0-9]+.*$
        

        in the .ini file it opens, then when you switch to your text file, the text

        red
        blah
        Something ERROR something
        blah code 1234 here
        

        would look like
        d7c6d943-d3de-4d55-b295-d5712ef04527-image.png

        Yuval KfirY 1 Reply Last reply Reply Quote 4
        • Yuval KfirY Offline
          Yuval Kfir @PeterJones
          last edited by

          @PeterJones Thank you! That is exactly what I needed.

          1 Reply Last reply Reply Quote 1

          Hello! It looks like you're interested in this conversation, but you don't have an account yet.

          Getting fed up of having to scroll through the same posts each visit? When you register for an account, you'll always come back to exactly where you were before, and choose to be notified of new replies (either via email, or push notification). You'll also be able to save bookmarks and upvote posts to show your appreciation to other community members.

          With your input, this post could be even better 💗

          Register Login
          • First post
            Last post
          The Community of users of the Notepad++ text editor.
          Powered by NodeBB | Contributors