Announcement

Collapse
No announcement yet.

Log Monitor Report when using RegEx

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    Log Monitor Report when using RegEx

    Steve, when a RegEx match occurs in the Log Monitor report the "Type" column shows "$1" for the match. Is that expected?

    Click image for larger version

Name:	Example.png
Views:	112
Size:	11.1 KB
ID:	1461617

    #2
    Originally posted by mterry63 View Post
    Steve, when a RegEx match occurs in the Log Monitor report the "Type" column shows "$1" for the match. Is that expected?

    Click image for larger version

Name:	Example.png
Views:	112
Size:	11.1 KB
ID:	1461617
    It shouldn't do. Can you post your RegEx.

    Steve

    Comment


      #3
      Originally posted by SteveMSJ View Post

      It shouldn't do. Can you post your RegEx.

      Steve
      Here's the RegEx:

      ^Error

      Just anchoring Error as the first thing in the "Type" string. If I just use "Error" I get a bunch of "Big5 Error" messages I don't want to see.

      Comment


        #4
        Originally posted by mterry63 View Post

        Here's the RegEx:

        ^Error

        Just anchoring Error as the first thing in the "Type" string. If I just use "Error" I get a bunch of "Big5 Error" messages I don't want to see.
        Try putting it in brackets
        (^Error)

        Steve

        Comment


          #5
          That works, thanks! Still matches but correctly reports "Error" as the type.

          Comment


            #6
            Originally posted by mterry63 View Post
            That works, thanks! Still matches but correctly reports "Error" as the type.
            I’m not familiar enough with RegEx to know why the replace doesn’t work without the brackets. It doesn’t seem right to me so I think I’ll code a workaround that adds the brackets to the replace if they aren’t there. It should then work either way.

            Steve

            Comment


              #7
              Originally posted by SteveMSJ View Post

              I’m not familiar enough with RegEx to know why the replace doesn’t work without the brackets. It doesn’t seem right to me so I think I’ll code a workaround that adds the brackets to the replace if they aren’t there. It should then work either way.

              Steve
              Having refreshed my memory about RegEx and how I coded the highlighting in the plug-in, I realise why you need the brackets. Basically I use the first capturing group to replace the text whilst adding enclosing html to set the font to red. If you don't have any capturing groups in your RegEx then it replaces the matched text with $1. You can create a capture group within your RegEx expression, the simplest way being to enclose the whole expression in brackets, which makes the whole expression a capturing group.

              I was going to change the code to add brackets around the RegEx, if they aren't already there. However, that would remove the flexibility to create the capture group within a more complex expression. I have therefore not altered the code but added a note to the guide.

              If you use simple search words and phrases, leaving the RegEx box unticked, then the plug-in handles the highlighting automatically anyway.

              Steve

              Comment

              Working...
              X