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!

Introducing the Splunk Community Dashboard Challenge!

Welcome to Splunk Community Dashboard Challenge! This is your chance to showcase your skills in creating ...

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 ...