Splunk Search

Regex expression

hashsplunk
Loves-to-Learn Lots

prd-sso-data-science-711-3006-compute-role

dev-1000-535-aibench-mlops-service-compute-role

 

above are the field values . I need to extract the code 711-3006 & 1000-535

I have given the regular expression  |rex field="Role" ".*(?<Projectcode>\d{3,4}-\d+)" but its not fetching the code properly . It give 000-535 in the second value. Kindly help

Labels (1)
0 Karma

manjunathmeti
Champion

Try this:

| rex field=Role "\w+-(?<Projectcode>\d{3,4}-\d+)-\w+"

 

If this reply helps you, an upvote/like would be appreciated.

0 Karma
Get Updates on the Splunk Community!

Announcing Scheduled Export GA for Dashboard Studio

We're excited to announce the general availability of Scheduled Export for Dashboard Studio. Starting in ...

Extending Observability Content to Splunk Cloud

Watch Now!   In this Extending Observability Content to Splunk Cloud Tech Talk, you'll see how to leverage ...

More Control Over Your Monitoring Costs with Archived Metrics GA in US-AWS!

What if there was a way you could keep all the metrics data you need while saving on storage costs?This is now ...