<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: How to find all values after a certain label in a field with regex? in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/How-to-find-all-values-after-a-certain-label-in-a-field-with/m-p/392689#M114230</link>
    <description>&lt;P&gt;hi Chandras11,&lt;BR /&gt;
regex doesn't seem correct, try:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;Location:(?&amp;lt;Location&amp;gt;[^ ]*)
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;you can test at &lt;A href="https://regex101.com/r/FEyqTW/1"&gt;https://regex101.com/r/FEyqTW/1&lt;/A&gt; &lt;/P&gt;

&lt;P&gt;Bye.&lt;BR /&gt;
Giuseppe&lt;/P&gt;</description>
    <pubDate>Wed, 16 May 2018 10:39:02 GMT</pubDate>
    <dc:creator>gcusello</dc:creator>
    <dc:date>2018-05-16T10:39:02Z</dc:date>
    <item>
      <title>How to find all values after a certain label in a field with regex?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-find-all-values-after-a-certain-label-in-a-field-with/m-p/392688#M114229</link>
      <description>&lt;P&gt;Hi All,&lt;BR /&gt;
I have a big text field with sample value as:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;Random text Location:AL432   1)ART: New order  ANYTHING  Location:B2332  1)ART: Any order   Random text 
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;I need to extract all the locations for example AL432 and B2332 and put them together in a new field. Please note that Location and 1)ART will always surround the location Id.&lt;BR /&gt;&lt;BR /&gt;
I can use something like:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;| rex field=_raw "Location: (?P&amp;lt;LocationID&amp;gt;\d+) \)ART:" | eval LOCATIONVALUES= case(match(TEXT,"Location"), LocationID)
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;But I am completely sure if my regex syntax is correct here. Also I need to put all Locations in LOCATIONVALUES together. &lt;/P&gt;

&lt;P&gt;Thanks in advance&lt;/P&gt;</description>
      <pubDate>Wed, 16 May 2018 10:32:24 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-find-all-values-after-a-certain-label-in-a-field-with/m-p/392688#M114229</guid>
      <dc:creator>Chandras11</dc:creator>
      <dc:date>2018-05-16T10:32:24Z</dc:date>
    </item>
    <item>
      <title>Re: How to find all values after a certain label in a field with regex?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-find-all-values-after-a-certain-label-in-a-field-with/m-p/392689#M114230</link>
      <description>&lt;P&gt;hi Chandras11,&lt;BR /&gt;
regex doesn't seem correct, try:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;Location:(?&amp;lt;Location&amp;gt;[^ ]*)
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;you can test at &lt;A href="https://regex101.com/r/FEyqTW/1"&gt;https://regex101.com/r/FEyqTW/1&lt;/A&gt; &lt;/P&gt;

&lt;P&gt;Bye.&lt;BR /&gt;
Giuseppe&lt;/P&gt;</description>
      <pubDate>Wed, 16 May 2018 10:39:02 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-find-all-values-after-a-certain-label-in-a-field-with/m-p/392689#M114230</guid>
      <dc:creator>gcusello</dc:creator>
      <dc:date>2018-05-16T10:39:02Z</dc:date>
    </item>
    <item>
      <title>Re: How to find all values after a certain label in a field with regex?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-find-all-values-after-a-certain-label-in-a-field-with/m-p/392690#M114231</link>
      <description>&lt;P&gt;Well, you can directly grab all matches into the field LOCATIONVALUES, eg:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;rex field=_raw max_match=0 "Location:(?&amp;lt;LOCATIONVALUES&amp;gt;\S+)"

# run everywhere:
| makeresults 
| eval input=" Random text Location:AL432   1)ART: New order  ANYTHING  Location:B2332  1)ART: Any order   Random text " 
| rex field=input max_match=0 "Location:(?&amp;lt;LOCATIONVALUES&amp;gt;\S+)"
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;You can then do what you need with the field, eg use mv commands to for it into something you like.&lt;/P&gt;</description>
      <pubDate>Wed, 16 May 2018 10:48:29 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-find-all-values-after-a-certain-label-in-a-field-with/m-p/392690#M114231</guid>
      <dc:creator>knielsen</dc:creator>
      <dc:date>2018-05-16T10:48:29Z</dc:date>
    </item>
    <item>
      <title>Re: How to find all values after a certain label in a field with regex?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-find-all-values-after-a-certain-label-in-a-field-with/m-p/392691#M114232</link>
      <description>&lt;P&gt;Thanks a lot. I am checking further in my query &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt; &lt;/P&gt;</description>
      <pubDate>Wed, 16 May 2018 10:52:07 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-find-all-values-after-a-certain-label-in-a-field-with/m-p/392691#M114232</guid>
      <dc:creator>Chandras11</dc:creator>
      <dc:date>2018-05-16T10:52:07Z</dc:date>
    </item>
    <item>
      <title>Re: How to find all values after a certain label in a field with regex?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-find-all-values-after-a-certain-label-in-a-field-with/m-p/392692#M114233</link>
      <description>&lt;P&gt;Thanks a lot. &lt;/P&gt;</description>
      <pubDate>Wed, 16 May 2018 10:52:43 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-find-all-values-after-a-certain-label-in-a-field-with/m-p/392692#M114233</guid>
      <dc:creator>Chandras11</dc:creator>
      <dc:date>2018-05-16T10:52:43Z</dc:date>
    </item>
    <item>
      <title>Re: How to find all values after a certain label in a field with regex?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-find-all-values-after-a-certain-label-in-a-field-with/m-p/392693#M114234</link>
      <description>&lt;P&gt;I tried it as : "^(.&lt;EM&gt;?)Location:(?\s&lt;/EM&gt;[^ ]&lt;EM&gt;) " which gives me just the first location. I need to extract all locations. &lt;BR /&gt;
Now its working for all events and ignore the white space after the location keyword (\s&lt;/EM&gt;). however, it just finds the first occurrence. Any way to get values together &lt;/P&gt;</description>
      <pubDate>Wed, 16 May 2018 14:28:08 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-find-all-values-after-a-certain-label-in-a-field-with/m-p/392693#M114234</guid>
      <dc:creator>Chandras11</dc:creator>
      <dc:date>2018-05-16T14:28:08Z</dc:date>
    </item>
    <item>
      <title>Re: How to find all values after a certain label in a field with regex?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-find-all-values-after-a-certain-label-in-a-field-with/m-p/392694#M114235</link>
      <description>&lt;P&gt;Thanks a lot for your help. FInally found the solution.&lt;BR /&gt;
For me it is:  &lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;| rex field=input max_match=0 "^(.*?)Location:(?&amp;lt;LOCATIONVALUES&amp;gt;\s*[^ ]*)" 
and it is working perfectly.
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Wed, 16 May 2018 14:44:10 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-find-all-values-after-a-certain-label-in-a-field-with/m-p/392694#M114235</guid>
      <dc:creator>Chandras11</dc:creator>
      <dc:date>2018-05-16T14:44:10Z</dc:date>
    </item>
    <item>
      <title>Re: How to find all values after a certain label in a field with regex?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-find-all-values-after-a-certain-label-in-a-field-with/m-p/392695#M114236</link>
      <description>&lt;P&gt;its working now. Need max_match as suggested by @knielsen&lt;/P&gt;</description>
      <pubDate>Wed, 16 May 2018 14:44:58 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-find-all-values-after-a-certain-label-in-a-field-with/m-p/392695#M114236</guid>
      <dc:creator>Chandras11</dc:creator>
      <dc:date>2018-05-16T14:44:58Z</dc:date>
    </item>
  </channel>
</rss>

