Splunk Search

Regex field values to look for a specific character Splunk Search

marktechuk
New Member

Hi guys I'm looking to extract a value from a field using regex, the field contain different types of data such as Id's, emails, name etc..in the same field.
I want a regex to look for a specific alphabetical character for example z thats followed by 10 numeric character for example z1234567890 I dont want to see any of the other values.

tried this (?\w{7,8})" but it also pull the out any other that start with z such as an email address and the the next 10 characters for example zack@abcdhg

Thanks Mt

0 Karma

mayurr98
Super Champion

try this

| makeresults | eval data="z1234567890" | rex field=data "(?<field_name>z\d{10})"

this should work for your case

(?<field_name>z\d{10})

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!

Leveraging Automated Threat Analysis Across the Splunk Ecosystem

Are you leveraging automation to its fullest potential in your threat detection strategy?Our upcoming Security ...

Can’t Make It to Boston? Stream .conf25 and Learn with Haya Husain

Boston may be buzzing this September with Splunk University and .conf25, but you don’t have to pack a bag to ...

Splunk Lantern’s Guide to The Most Popular .conf25 Sessions

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