Regex in search assistance


(Cprofitt) #1

I am trying to build a regex to match strings as follows:

PDCS-MBX01$
pluto$
12-2423$

I tried using the following:
winlogbeat_event_data_SubjectUserName:(\w\W)+$

I thought the search should have been: [\w\W]+$, but Graylog does not like the [ or ] characters.

Can anyone assist with a regex that will be accepted by Graylog and match all three of the above string types?


Search using regex
Search using regex
(Jochen) #2

$ is a special character in regular expressions meaning “end of input”.

The following regular expression will match these strings:

([\w-]+\$)

You can play around with your regular expressions on pages like http://www.freeformatter.com/java-regex-tester.html.