Splunk Search

How do I get specific, but separate count of letters and numbers in a result?

Shaurdonnay
Engager

I am trying to figure out how to pull fields to show the exact count of numbers and letters in a result. Like, if I have the result 11tt3yyy1, I want the fields to show me that there is 4 numbers and 5 letters. Is there a way to do this? I have tried everything I can think of.

Labels (5)
0 Karma
1 Solution

ITWhisperer
SplunkTrust
SplunkTrust
| makeresults
| eval _raw="11tt3yyy1"
| rex max_match=0 "(?<digit>[[:digit:]])|(?<letter>[[:alpha:]])"
| eval digits=mvcount(digit)
| eval letters=mvcount(letter)

View solution in original post

0 Karma

ITWhisperer
SplunkTrust
SplunkTrust
| makeresults
| eval _raw="11tt3yyy1"
| rex max_match=0 "(?<digit>[[:digit:]])|(?<letter>[[:alpha:]])"
| eval digits=mvcount(digit)
| eval letters=mvcount(letter)
0 Karma

Shaurdonnay
Engager

Perfect! Thank you very much!

0 Karma
Get Updates on the Splunk Community!

Splunk Observability for AI

Don’t miss out on an exciting Tech Talk on Splunk Observability for AI!Discover how Splunk’s agentic AI ...

Splunk Enterprise Security 8.x: The Essential Upgrade for Threat Detection, ...

Watch On Demand the Tech Talk on November 6 at 11AM PT, and empower your SOC to reach new heights! Duration: ...

Splunk Observability as Code: From Zero to Dashboard

For the details on what Self-Service Observability and Observability as Code is, we have some awesome content ...