Community
    • Login

    Having notepad++ autohighlight certain values when they are non zero

    Scheduled Pinned Locked Moved Help wanted · · · – – – · · ·
    2 Posts 2 Posters 2.3k Views 1 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.
    • Matthew MillardM Offline
      Matthew Millard
      last edited by

      I use Notepad ++ to analyze error logs. One piece of information i look for is clipping duration greater than zero. It indicates the microphone volume needs adjusted. I appears in the log as so:

      SigQual[ uD 1633 | Nd 0 | sN 16 |** cD 0** | wF 0x00 | aF 0x00 | dA 0.0 [63561] | sA 14.6 [5882] | Rt D ]

      I have bolded the cD part for emphasis.

      Here is my question, how can I have notepad++ highlight any non zero value when it occurs next to the letters cD.

      I am not a programmer, BTW. Your explanation might need to be relatively non technical for me to understand.

      1 Reply Last reply Reply Quote 0
      • guy038G Offline
        guy038
        last edited by guy038

        Hello, @matthew-millard,

        Not too difficult with the right regular expression !

        So, using, for instance, the example text, below :

        SigQual[ uD 1633 | Nd 0 | sN 16 | cD 23 | wF 0x00 | aF 0x00 | dA 0.0 [63561] | sA 14.6 [5882] | Rt D ]
        SigQual[ uD 1633 | Nd 0 | sN 16 | cD 0 | wF 0x00 | aF 0x00 | dA 0.0 [63561] | sA 14.6 [5882] | Rt D ]
        SigQual[ uD 1633 | Nd 0 | sN 16 | cD 1 | wF 0x00 | aF 0x00 | dA 0.0 [63561] | sA 14.6 [5882] | Rt D ]
        SigQual[ uD 1633 | Nd 0 | sN 16 | cD 127 | wF 0x00 | aF 0x00 | dA 0.0 [63561] | sA 14.6 [5882] | Rt D ]
        SigQual[ uD 1633 | Nd 0 | sN 16 | cD 0 | wF 0x00 | aF 0x00 | dA 0.0 [63561] | sA 14.6 [5882] | Rt D ]
        SigQual[ uD 1633 | Nd 0 | sN 16 | cD 1234 | wF 0x00 | aF 0x00 | dA 0.0 [63561] | sA 14.6 [5882] | Rt D ]
        
        • Open the Find dialog ( CTRL + F )

        • In the Find what: zone, type in the regular expression, below :

        (?-i)(?<= cD )(?!0 )\d+

        • Check the Wrap around option

        • Select the Regular expression serach mode ( IMPORTANT )

        • Click on the Find Next button

        => You should get the next number, different from 0, located after the string cD, in that exact case. Et voilà !! ( only the second and fifth lines will be skipped ! )


        Notes :

        • The first part (?-i) forces the regex engine to search, in a sensitive way ( = non-insensitive )

        • The final part \d+ is the real string to search for, that is to say, a digit ( \d ), repeated one or more times ( + ) ( idem a number ! )

        • But, this number will be matched by the regex engine, IF and ONlY IF the two following conditions are TRUE :

          • Before the number location, the string " cD ", with two spaces and without doubles quotes, DO exist ( positive look-behind syntax : (?<= cD ) )

          • At number location, the string "0 ", with one space and without doubles quotes, does NOT exist ( negative look-ahead syntax : (?!0 ) )

        Best Regards,

        guy038

        1 Reply Last reply Reply Quote 0

        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