Splunk Search

Group by multiselect regex number range

l0gik
Explorer

I have a multiselect option in my dashboard that defines regex number ranges. I want to then group the "selected" number range elements and compare those against the ones that weren't selected. To begin my number range elements look like this:
(852[01])
(4[0-4][0-9]{2}|45[0-7][0-9]|458[01])
(850[0-9]|851[0-3])
(831[4-9]|83[2-9][0-9]|84[0-5][0-9]|846[0-7])

Note, these are regex ranges.

My search contains the field value to compare the regex against,
Message{}.itemnumber = itemNumber is the field value to check against regex number ranges
I tried
| eval SELECTED=case(itemNumber=$ITEM_NUMBER$, Selected, 1=1, Unselected)
Any suggestions on how to accomplish this?

Tags (3)
0 Karma

richgalloway
SplunkTrust
SplunkTrust

The = operator is a literal character-for-character comparison, which won't work for regex strings. Use the match function, instead.

| eval SELECTED=case(match(itemNumber, $ITEM_NUMBER|s$), Selected, 1=1, Unselected)
---
If this reply helps you, Karma would be appreciated.
0 Karma

l0gik
Explorer

What is the |s in the $ITEM_NUMBER$ token?

0 Karma

richgalloway
SplunkTrust
SplunkTrust

It puts the value inside quotation marks.

---
If this reply helps you, Karma would be appreciated.
0 Karma
Got questions? Get answers!

Join the Splunk Community Slack to learn, troubleshoot, and make connections with fellow Splunk practitioners in real time!

Meet up IRL or virtually!

Join Splunk User Groups to connect and learn in-person by region or remotely by topic or industry.

Get Updates on the Splunk Community!

Design, Compete, Win: Submit Your Best Splunk Dashboards for a .conf26 Pass

Hello Splunkers,  We’re excited to kick off a Splunk Dashboard contest! We know that dashboards are a primary ...

May 2026 Splunk Expert Sessions: Security & Observability

Level Up Your Operations: May 2026 Splunk Expert Sessions Whether you are refining your security posture or ...

Network to App: Observability Unlocked [May & June Series]

In today’s digital landscape, your environment is no longer confined to the data center. It spans complex ...