Regex doesn't match

Tags:

#1 cmiscloni

Hi all,

Sorry to come with an other new question about that but I don't understand why the regex didn't match the Message:

regexp /(?x)^\s?[(\d+):(\d+):(\d+)] (.+?) [Classification: (.+?)] [Priority: (\d+)] {(.+?)} (\d{1,3}.\d{1,3}.\d{1,3}.\d{1,3})(:(\d{1,5}))? -> (\d{1,3}.\d{1,3}.\d{1,3}.\d{1,3})(:(\d{1,5}))?\R?/ doesn't match subject string '[129:20:1] TCP session without 3-way handshake [Classification: Potentially Bad Traffic] [Priority: 2] {TCP} 192.168.0.1:8080 -> 192.168.0.2:53590'

If I compare that on Online regex site (PCRE), it works.

Thanks

#2 manuel.munozDeactivated Nxlog ✓
#1 cmiscloni
Hi all, Sorry to come with an other new question about that but I don't understand why the regex didn't match the Message: regexp /(?x)^\s?[(\d+):(\d+):(\d+)] (.+?) [Classification: (.+?)] [Priority: (\d+)] {(.+?)} (\d{1,3}.\d{1,3}.\d{1,3}.\d{1,3})(:(\d{1,5}))? -> (\d{1,3}.\d{1,3}.\d{1,3}.\d{1,3})(:(\d{1,5}))?\R?/ doesn't match subject string '[129:20:1] TCP session without 3-way handshake [Classification: Potentially Bad Traffic] [Priority: 2] {TCP} 192.168.0.1:8080 -> 192.168.0.2:53590' If I compare that on Online regex site (PCRE), it works. Thanks

Hey Nicolas,

I'm using regex101.com to validate your regex. You need to remove (?x) from the beginning of it and it will match.

https://i.imgur.com/BBAYa2V.png