How to use message -> like (regex) to match beginning of line

Notes, tips, and other usefull things on how to use LogMX

Moderator: admin

Post Reply
entrecanoer
Posts: 2
Joined: Wed Jan 12, 2022 8:41 pm

How to use message -> like (regex) to match beginning of line

Post by entrecanoer »

I have many log entries that start with the text “QM42VT2”. I am trying to use the manual filter “Message -> like (regex)” to show those lines. I have tried many combinations of the regex string like:

^QM42VT2
^QM42VT2*
“^QM42VT2”
“^QM42VT2*”

But always get no logs entries shown. Here is an example log entry I am trying to show:

[Entry id=1087, date=2022-01-11 21:46:51.801, level=INFO, thread=pool-5-thread-1, emitter=com.Rexnord.Properties.Computed.WindowedDoubleProperty, message="QM42VT2:LoSpdOut:GMF-4-3xAvgIPS" value: 4.878638428635895E-4]

Any idea why this is not working?
admin
Site Admin
Posts: 554
Joined: Sun Dec 17, 2006 10:30 pm

Re: How to use message -> like (regex) to match beginning of line

Post by admin »

We actually followed-up this conversation over email :D In case it helps others on this forum, the regex that should be used here is:

Code: Select all

^"QM42VT2.*
(to match every string starting with "QM42VT2, quote included)
entrecanoer
Posts: 2
Joined: Wed Jan 12, 2022 8:41 pm

Re: How to use message -> like (regex) to match beginning of line

Post by entrecanoer »

Thanks for answering this. I also found the following to be helpful:

The missing part was the “.*” at the end, which means “any character, any number of times” (“.” means “any character”, and “*” means “0 or more times”)
You can learn more about Regular expressions syntax here:
https://docs.oracle.com/javase/8/docs/a ... ttern.html
admin
Site Admin
Posts: 554
Joined: Sun Dec 17, 2006 10:30 pm

Re: How to use message -> like (regex) to match beginning of line

Post by admin »

You're right, thanks for sharing! :D
Post Reply