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!

Stay Connected: Your Guide to May Tech Talks, Office Hours, and Webinars!

Take a look below to explore our upcoming Community Office Hours, Tech Talks, and Webinars this month. This ...

They're back! Join the SplunkTrust and MVP at .conf24

With our highly anticipated annual conference, .conf, comes the fez-wearers you can trust! The SplunkTrust, as ...

Enterprise Security Content Update (ESCU) | New Releases

Last month, the Splunk Threat Research Team had two releases of new security content via the Enterprise ...