Splunk Search

Extract characters without digit

royimad
Builder

I have a field in the log like the following:
abc1232
ab.sadkjsakj21302139
abc3400349
alex.carl2103920

I need to extract all characters without the digital number. How to do that using regular expression? rex or interactive field extraction?

Thanks

Tags (3)
0 Karma

alacercogitatus
SplunkTrust
SplunkTrust

If you are going to be using it repeatedly, I would place it in a props/transforms. But you can do it via search line.

|rex field=myfield "(?<no_digits>[^\d]*)"

OR with props.conf

[mysourcetype]
EXTRACT-myfield = (?<no_digits>[^\d]*) in myfield

gfuente
Motivator

Hello

You could use this regular expresion:

(?<mystring>\D+)

And using the rex command:

... | rex "(?< mystring >\D+)" | ...

*Without the spaces before and after the field name

Regards

Get Updates on the Splunk Community!

Index This | I am a number, but when you add ‘G’ to me, I go away. What number am I?

March 2024 Edition Hayyy Splunk Education Enthusiasts and the Eternally Curious!  We’re back with another ...

What’s New in Splunk App for PCI Compliance 5.3.1?

The Splunk App for PCI Compliance allows customers to extend the power of their existing Splunk solution with ...

Extending Observability Content to Splunk Cloud

Register to join us !   In this Extending Observability Content to Splunk Cloud Tech Talk, you'll see how to ...