• Login
Community
  • Login

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

Scheduled Pinned Locked Moved Help wanted · · · – – – · · ·
2 Posts 2 Posters 2.1k 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.
  • M
    Matthew Millard
    last edited by Apr 6, 2017, 5:50 PM

    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
    • G
      guy038
      last edited by guy038 Apr 6, 2017, 10:19 PM Apr 6, 2017, 10:11 PM

      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
      2 out of 2
      • First post
        2/2
        Last post
      The Community of users of the Notepad++ text editor.
      Powered by NodeBB | Contributors