Splunk Search

"Invalid Regex: no named extraction" in the interactive field extractor

dinh
Path Finder

What is wrong with this regex?

(?P<AUTH_PIN_TYPE>[^ ]+)( [^ ]+){2}$

The interactive field extractor gives this error: Invalid regex: no named extraction at position 24 (i.e., "( [^ ]+){2..."). Expected "(?Ppattern)"

Tags (1)
0 Karma
1 Solution

gkanapathy
Splunk Employee
Splunk Employee

As far as I can see, and testing in Splunk 4.0.8 using rex, EXTRACT in props.conf, and a REPORT clause, there appears to be nothing wrong with it (assuming it correctly captures your fields). Where are you seeing this error?

Update: in the IFE, as GpMidi says, you can use only named captures, i.e., implicit captures like (...) are not accepted. If you just wish to group (without an implicit capture), use (?:...) instead. So your regex in this case would have to be:

(?P<AUTH_PIN_TYPE>[^ ]+)(?: [^ ]+){2}$

View solution in original post

dinh
Path Finder

blah blah blah MATCH_ME foo bar(end of line)

0 Karma

gkanapathy
Splunk Employee
Splunk Employee

As far as I can see, and testing in Splunk 4.0.8 using rex, EXTRACT in props.conf, and a REPORT clause, there appears to be nothing wrong with it (assuming it correctly captures your fields). Where are you seeing this error?

Update: in the IFE, as GpMidi says, you can use only named captures, i.e., implicit captures like (...) are not accepted. If you just wish to group (without an implicit capture), use (?:...) instead. So your regex in this case would have to be:

(?P<AUTH_PIN_TYPE>[^ ]+)(?: [^ ]+){2}$

dinh
Path Finder

I see it on Splunk 4.0.9(74233) when I put it in the interactive field extractor.

0 Karma

GpMidi
Explorer

I belive you need to use all named captures. ie (?P...)

0 Karma

hulahoop
Splunk Employee
Splunk Employee

Can you provide more details? What are you trying to match?

0 Karma
Get Updates on the Splunk Community!

Take Your Breath Away with Splunk Risk-Based Alerting (RBA)

WATCH NOW!The Splunk Guide to Risk-Based Alerting is here to empower your SOC like never before. Join Haylee ...

SignalFlow: What? Why? How?

What is SignalFlow? Splunk Observability Cloud’s analytics engine, SignalFlow, opens up a world of in-depth ...

Federated Search for Amazon S3 | Key Use Cases to Streamline Compliance Workflows

Modern business operations are supported by data compliance. As regulations evolve, organizations must ...