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 AI Assistant for SPL | Key Use Cases to Unlock the Power of SPL

Splunk AI Assistant for SPL | Key Use Cases to Unlock the Power of SPL  The Splunk AI Assistant for SPL ...

Buttercup Games: Further Dashboarding Techniques (Part 5)

This series of blogs assumes you have already completed the Splunk Enterprise Search Tutorial as it uses the ...

Customers Increasingly Choose Splunk for Observability

For the second year in a row, Splunk was recognized as a Leader in the 2024 Gartner® Magic Quadrant™ for ...