<?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: Help with regex for field extraction in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/Help-with-regex-for-field-extraction/m-p/492811#M137446</link>
    <description>&lt;P&gt;After banging my head for a bit, I coded below run any where and it worked!!! &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;| gentimes start=-1 

| eval Location="/COMPANY LOCATIONS/PA/PHILADELPHIA/ABC - PHILADELPHIA/"

| table Location

| rex field=Location "^(?:[^\/\n]*\/){2}(?P&amp;lt;State&amp;gt;\w+)\/(?P&amp;lt;City&amp;gt;[^\/]+)\/(?P&amp;lt;Code&amp;gt;[^\/]+)"
&lt;/CODE&gt;&lt;/PRE&gt;</description>
    <pubDate>Fri, 22 Nov 2019 20:03:16 GMT</pubDate>
    <dc:creator>mbasharat</dc:creator>
    <dc:date>2019-11-22T20:03:16Z</dc:date>
    <item>
      <title>Help with regex for field extraction</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Help-with-regex-for-field-extraction/m-p/492809#M137444</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;

&lt;P&gt;I have a field value as below. &lt;BR /&gt;
These are all fixed positions all across.&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;/COMPANY LOCATIONS/PA/PHILADELPHIA/ABC - PHILADELPHIA/
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;I need two regex:&lt;/P&gt;

&lt;OL&gt;
&lt;LI&gt;Only State extracted from above new fields labeled as STATE&lt;/LI&gt;
&lt;LI&gt;All fields extracted as LOCATION, STATE, CITY, CODE&lt;/LI&gt;
&lt;/OL&gt;

&lt;P&gt;Thanks in advance!!!&lt;/P&gt;</description>
      <pubDate>Fri, 22 Nov 2019 19:09:38 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Help-with-regex-for-field-extraction/m-p/492809#M137444</guid>
      <dc:creator>mbasharat</dc:creator>
      <dc:date>2019-11-22T19:09:38Z</dc:date>
    </item>
    <item>
      <title>Re: Help with regex for field extraction</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Help-with-regex-for-field-extraction/m-p/492810#M137445</link>
      <description>&lt;P&gt;Could you please provide some more sample inputs and the expected output. For example, when you say you need LOCATION, STATE, CITY, CODE, what values should each of these hold with respect to your sample data?&lt;/P&gt;</description>
      <pubDate>Fri, 22 Nov 2019 19:27:38 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Help-with-regex-for-field-extraction/m-p/492810#M137445</guid>
      <dc:creator>arjunpkishore5</dc:creator>
      <dc:date>2019-11-22T19:27:38Z</dc:date>
    </item>
    <item>
      <title>Re: Help with regex for field extraction</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Help-with-regex-for-field-extraction/m-p/492811#M137446</link>
      <description>&lt;P&gt;After banging my head for a bit, I coded below run any where and it worked!!! &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;| gentimes start=-1 

| eval Location="/COMPANY LOCATIONS/PA/PHILADELPHIA/ABC - PHILADELPHIA/"

| table Location

| rex field=Location "^(?:[^\/\n]*\/){2}(?P&amp;lt;State&amp;gt;\w+)\/(?P&amp;lt;City&amp;gt;[^\/]+)\/(?P&amp;lt;Code&amp;gt;[^\/]+)"
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Fri, 22 Nov 2019 20:03:16 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Help-with-regex-for-field-extraction/m-p/492811#M137446</guid>
      <dc:creator>mbasharat</dc:creator>
      <dc:date>2019-11-22T20:03:16Z</dc:date>
    </item>
    <item>
      <title>Re: Help with regex for field extraction</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Help-with-regex-for-field-extraction/m-p/492812#M137447</link>
      <description>&lt;P&gt;Hi Arjun. See my own answer to my own question. Took some head bangs at this time of Friday! &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Fri, 22 Nov 2019 20:03:58 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Help-with-regex-for-field-extraction/m-p/492812#M137447</guid>
      <dc:creator>mbasharat</dc:creator>
      <dc:date>2019-11-22T20:03:58Z</dc:date>
    </item>
    <item>
      <title>Re: Help with regex for field extraction</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Help-with-regex-for-field-extraction/m-p/492813#M137448</link>
      <description>&lt;P&gt;Like this:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;| makeresults 
| eval _raw="/COMPANY LOCATIONS/PA/PHILADELPHIA/ABC - PHILADELPHIA/" 
| rex "^\/(?&amp;lt;WHATEVER&amp;gt;[^\/]+)\/(?&amp;lt;LOCATION&amp;gt;[^\/]+)\/(?&amp;lt;STATE&amp;gt;[^\/]+)\/(?&amp;lt;CITY&amp;gt;[^\/]+)\/"
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;I am not sure what is supposed to be &lt;CODE&gt;CODE&lt;/CODE&gt; ... ?&lt;/P&gt;</description>
      <pubDate>Fri, 22 Nov 2019 20:24:33 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Help-with-regex-for-field-extraction/m-p/492813#M137448</guid>
      <dc:creator>woodcock</dc:creator>
      <dc:date>2019-11-22T20:24:33Z</dc:date>
    </item>
  </channel>
</rss>

