Splunk Search

Incorrect Regex

IRHM73
Motivator

Hi, I wonder whether someone may be able to help me please.

I've created this regex \"Surname\\":\\"(?<SName>[^"]+)\\" which extracts the Surname from the following raw data:

"Surname\":\"SMITH\"

This works fine in Regex101, but I when I add this to my query here:

auditSource=tamc auditType=OutboundCall | rex field=_raw "\"Surname\\":\\"(?<SName>[^"]+)\\""

I receive the following error:

Mismatched ']'.

I just wondered whether someone may be able to look at this please and let me know where I've gone wrong.

Many thanks and kind regards

Chris

Tags (2)
0 Karma
1 Solution

woodcock
Esteemed Legend

Like this:

"Surname":"(?<SName>[^"]+)"

And this:

auditSource=tamc auditType=OutboundCall | rex field=_raw "\"Surname\":\"(?<SName>[^\"]+)\""

View solution in original post

0 Karma

woodcock
Esteemed Legend

Like this:

"Surname":"(?<SName>[^"]+)"

And this:

auditSource=tamc auditType=OutboundCall | rex field=_raw "\"Surname\":\"(?<SName>[^\"]+)\""
0 Karma

IRHM73
Motivator

Hi @woodcock thank you for coming back to me with the solution.

Kind regards

Chris

0 Karma

stephanefotso
Motivator

Hello try this: auditSource=tamc auditType=OutboundCall | rex field=_raw "\"Surname\":\"(?[^\"]+)\""

SGF
0 Karma

IRHM73
Motivator

Hi thank you for coming back to me with this, but unfortunately I still receive the same error.

I'm able to get past the error using rex field=_raw "\"Surname\":\"(?[^\"]+)\"" but it is not extracting any information.

Kind Regards

Chris

0 Karma
Career Survey
First 500 qualified respondents will receive a $20 gift card! Tell us about your professional Splunk journey.

Can’t make it to .conf25? Join us online!

Get Updates on the Splunk Community!

What Is Splunk? Here’s What You Can Do with Splunk

Hey Splunk Community, we know you know Splunk. You likely leverage its unparalleled ability to ingest, index, ...

Level Up Your .conf25: Splunk Arcade Comes to Boston

With .conf25 right around the corner in Boston, there’s a lot to look forward to — inspiring keynotes, ...

Manual Instrumentation with Splunk Observability Cloud: How to Instrument Frontend ...

Although it might seem daunting, as we’ve seen in this series, manual instrumentation can be straightforward ...