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!

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

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

Combine Multiline Logs into a Single Event with SOCK: a Step-by-Step Guide for ...

Combine multiline logs into a single event with SOCK - a step-by-step guide for newbies Olga Malita The ...