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!

.conf24 | Registration Open!

Hello, hello! I come bearing good news: Registration for .conf24 is now open!   conf is Splunk’s rad annual ...

ICYMI - Check out the latest releases of Splunk Edge Processor

Splunk is pleased to announce the latest enhancements to Splunk Edge Processor.  HEC Receiver authorization ...

Introducing the 2024 SplunkTrust!

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