Splunk Search

rex for extract codes

indeed_2000
Motivator

hi
what is the rex for extract all brackets contain this pattern
[AB_123] [ZXY_987]

1-check all brackets if start with AB_ extract this AB_123
2-check all brackets if start with ZXY_ extract this ZXY_987
3-put all this in single field that call "Codes"

any idea?
thanks

Labels (4)
0 Karma
1 Solution

ITWhisperer
SplunkTrust
SplunkTrust
| rex max_match=0 "\[(?<Codes>(AB|ZXY)[^\]]+)"

View solution in original post

ITWhisperer
SplunkTrust
SplunkTrust
| rex max_match=0 "\[(?<Codes>(AB|ZXY)[^\]]+)"
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 ...