Splunk Search

Regular expression help and error (Regex: unmatched parentheses )

Michael_Schyma1
Contributor

The regular expression is correct according to RegExr, but i keep on getting this error

Regex: unmatched parentheses

I am not understanding why my regular expression is not working. Here is what i have in Splunk Search:

rex field=_raw "Member:\W+Security.ID:\W+TARD\\(?<member_added>\S+)"

I just dont see it for whatever reason. Thanks guys

Tags (1)
0 Karma
1 Solution

Rob
Splunk Employee
Splunk Employee

I take it you are trying to escape a backslash character. In that case you need to use 3 backslashes in the rex command like this:

rex field=_raw "Member:\W+Security.ID:\W+TARD\\\(?<member_added>\S+)"

View solution in original post

Rob
Splunk Employee
Splunk Employee

I take it you are trying to escape a backslash character. In that case you need to use 3 backslashes in the rex command like this:

rex field=_raw "Member:\W+Security.ID:\W+TARD\\\(?<member_added>\S+)"

raoul
Path Finder

This works, but why? Why does Splunk require three? By my logic I am escaping a backslash - one other backslash should do the trick...

Get Updates on the Splunk Community!

More Ways To Control Your Costs With Archived Metrics | Register for Tech Talk

Tuesday, May 14, 2024  |  11AM PT / 2PM ET Register to Attend Join us for this Tech Talk and learn how to ...

.conf24 | Personalize your .conf experience with Learning Paths!

Personalize your .conf24 Experience Learning paths allow you to level up your skill sets and dive deeper ...

Threat Hunting Unlocked: How to Uplevel Your Threat Hunting With the PEAK Framework ...

WATCH NOWAs AI starts tackling low level alerts, it's more critical than ever to uplevel your threat hunting ...