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!

Introducing the 2024 SplunkTrust!

Hello, Splunk Community! We are beyond thrilled to announce our newest group of SplunkTrust members!  The ...

Introducing the 2024 Splunk MVPs!

We are excited to announce the 2024 cohort of the Splunk MVP program. Splunk MVPs are passionate members of ...

Splunk Custom Visualizations App End of Life

The Splunk Custom Visualizations apps End of Life for SimpleXML will reach end of support on Dec 21, 2024, ...