Splunk Search

How to write a regular expression so that it’s case sensitive and only looks at ABC and not Abc or abc?

abhijit_mhatre
Path Finder

Please let me know the regex for this.
How can the extracted field be modified?

Thanks

1 Solution

gokadroid
Motivator

How about trying this:

(ABC) which matches ABC as a string and does not match Abc or abc see here

[ABC] on the other hand will match either A, B or C see here

[ABC]+ will match any combinations of one or more ABCs like AABBCC, ABC, Abc (A is matched in Abc ) and so on... see here

So please use accordingly.

View solution in original post

0 Karma

gokadroid
Motivator

How about trying this:

(ABC) which matches ABC as a string and does not match Abc or abc see here

[ABC] on the other hand will match either A, B or C see here

[ABC]+ will match any combinations of one or more ABCs like AABBCC, ABC, Abc (A is matched in Abc ) and so on... see here

So please use accordingly.

0 Karma

cmerriman
Super Champion

[ABC] should only look at ABC and not Abc or abc. However, :upper and :lower can be used, and i makes things case insensitive.

you can test regexes here: https://regex101.com/

Get Updates on the Splunk Community!

Built-in Service Level Objectives Management to Bridge the Gap Between Service & ...

Wednesday, May 29, 2024  |  11AM PST / 2PM ESTRegister now and join us to learn more about how you can ...

Get Your Exclusive Splunk Certified Cybersecurity Defense Engineer Certification at ...

We’re excited to announce a new Splunk certification exam being released at .conf24! If you’re headed to Vegas ...

Share Your Ideas & Meet the Lantern team at .Conf! Plus All of This Month’s New ...

Splunk Lantern is Splunk’s customer success center that provides advice from Splunk experts on valuable data ...