Splunk Search

How to edit my rex statement to extract the name out of this example string?

packet_hunter
Contributor

I am trying to rex out a person name out of the following....

.... @ xyz-2\\\\johndoe&........

Here is my current search:

sourcetype=A_cef_syslog category="ThisONe" | rex field=ThatONe "\@(?[\w+\d\-\\ ]+) " | stats list(person)

Ideally I would like the match to start with @ and stop at &...

Any help is much appreciated,

thank you!!!

0 Karma
1 Solution

sundareshr
Legend

Try this

... | rex field=ThatONe "@(?<name>[^\&]+)" | ...

View solution in original post

0 Karma

sundareshr
Legend

Try this

... | rex field=ThatONe "@(?<name>[^\&]+)" | ...
0 Karma

packet_hunter
Contributor

Thank you!!!

Lately I have been using online regex tester to test my rex code but apparently what works in the online tester doesn't always work... any other testing suggestions other than the obvious- "RTFM again" (which I am going to do)?

0 Karma
Get Updates on the Splunk Community!

Built-in Service Level Objectives Management to Bridge the Gap Between Service & ...

Wednesday, May 29, 2024  |  11AM PST / 2PM ESTRegister now and join us to learn more about how you can ...

Get Your Exclusive Splunk Certified Cybersecurity Defense Engineer at Splunk .conf24 ...

We’re excited to announce a new Splunk certification exam being released at .conf24! If you’re headed to Vegas ...

Share Your Ideas & Meet the Lantern team at .Conf! Plus All of This Month’s New ...

Splunk Lantern is Splunk’s customer success center that provides advice from Splunk experts on valuable data ...