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!

Announcing Scheduled Export GA for Dashboard Studio

We're excited to announce the general availability of Scheduled Export for Dashboard Studio. Starting in ...

Extending Observability Content to Splunk Cloud

Watch Now!   In this Extending Observability Content to Splunk Cloud Tech Talk, you'll see how to leverage ...

More Control Over Your Monitoring Costs with Archived Metrics GA in US-AWS!

What if there was a way you could keep all the metrics data you need while saving on storage costs?This is now ...