Splunk Search

How can I edit my regex to exclude the words "query" and "in" from a string?

ashnet16
Path Finder

I'm trying to exclude the word query and in from my string to create a new field called query. I'm not having any luck excluding the two outliers.

| rex "(?P<"Query">(query)\b.*\b(in\s))"

Example String: Query id,caption,alttext,height,width,urlimage,tracking_name,tracking_link_name,tracking_section in.
Output desired: id,caption,alttext,height,width,urlimage,tracking_name,tracking_link_name,tracking_section

Tags (3)
0 Karma
1 Solution

MuS
Legend

Hi ashnet16,

try this:

| rex "[qQ]uery\s(?P<Query>.*)\sin" 

cheers, MuS

View solution in original post

MuS
Legend

Hi ashnet16,

try this:

| rex "[qQ]uery\s(?P<Query>.*)\sin" 

cheers, MuS

ashnet16
Path Finder

Works perfectly! Thanks!

0 Karma
Get Updates on the Splunk Community!

Webinar Recap | Revolutionizing IT Operations: The Transformative Power of AI and ML ...

The Transformative Power of AI and ML in Enhancing Observability   In the realm of IT operations, the ...

.conf24 | Registration Open!

Hello, hello! I come bearing good news: Registration for .conf24 is now open!   conf is Splunk’s rad annual ...

ICYMI - Check out the latest releases of Splunk Edge Processor

Splunk is pleased to announce the latest enhancements to Splunk Edge Processor.  HEC Receiver authorization ...