Splunk Search

Regex for filter in creating pivot

jpcool
New Member

Hello,

I need to create a pivot where I need to filter the records based on the starting characters of string field i.e only strings starting with characters in the set from A to F and create another pivot for nly strings starting with characters from F to J and so on. I tried with RegEx [a-f] and [a-fA-F] but no luck. I am new to using RegEx with Splunk. Can anyone help how to create filter for field to chose string with only certain characters ?

Thanks,
Jp

0 Karma

ddrillic
Ultra Champion

If we run the following -

| eval data="A11111"
| rex  field=data "(?<user>[A-F]+.*)"  

the generated field user would have value only if the data starts with A-F.

Is this what you are after?

0 Karma

ryanoconnor
Builder

Can you give some examples of strings you have and what you want to capture? Regex's are much easier to assist with if we can visualize what you're seeing. Also take a look at tools like https://regex101.com/ or http://regexr.com/

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!

Community Content Calendar, September edition

Welcome to another insightful post from our Community Content Calendar! We're thrilled to continue bringing ...

Splunkbase Unveils New App Listing Management Public Preview

Splunkbase Unveils New App Listing Management Public PreviewWe're thrilled to announce the public preview of ...

Leveraging Automated Threat Analysis Across the Splunk Ecosystem

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