<?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 in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/Help-with-regex/m-p/349627#M103495</link>
    <description>&lt;P&gt;I want to extract the 78216 into field called ZIP&lt;/P&gt;</description>
    <pubDate>Tue, 19 Dec 2017 20:52:57 GMT</pubDate>
    <dc:creator>vrmandadi</dc:creator>
    <dc:date>2017-12-19T20:52:57Z</dc:date>
    <item>
      <title>Help with regex</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Help-with-regex/m-p/349622#M103490</link>
      <description>&lt;P&gt;I have the below sample data &lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;sample 1
`&amp;lt;TargetCode key="Zip5"&amp;gt;78216&amp;lt;/TargetCode&amp;gt;`
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;sample 2&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;&amp;lt;adm:TargetCode key="Zip5" account="1"&amp;gt;78216&amp;lt;/adm:TargetCode&amp;gt;
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;I am using the below regex &lt;BR /&gt;
&lt;CODE&gt;*\"Zip5\"|&amp;gt;(?&amp;lt;ZipCode&amp;gt;.*?)\&amp;lt;\/.*&lt;/CODE&gt; ...but this is not extracting the one in sample 2.&lt;/P&gt;

&lt;P&gt;Thanks in advance&lt;/P&gt;</description>
      <pubDate>Tue, 19 Dec 2017 20:07:05 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Help-with-regex/m-p/349622#M103490</guid>
      <dc:creator>vrmandadi</dc:creator>
      <dc:date>2017-12-19T20:07:05Z</dc:date>
    </item>
    <item>
      <title>Re: Help with regex</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Help-with-regex/m-p/349623#M103491</link>
      <description>&lt;P&gt;Which value you want to extract and what's the field name? Please format the code/regex by selecting it and pressing Ctrl+K so that formatting is retained.&lt;/P&gt;</description>
      <pubDate>Tue, 19 Dec 2017 20:16:05 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Help-with-regex/m-p/349623#M103491</guid>
      <dc:creator>somesoni2</dc:creator>
      <dc:date>2017-12-19T20:16:05Z</dc:date>
    </item>
    <item>
      <title>Re: Help with regex</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Help-with-regex/m-p/349624#M103492</link>
      <description>&lt;P&gt;Hows this? &lt;BR /&gt;
    &lt;CODE&gt;Zip5".*?\&amp;gt;(?&amp;lt;ZIP&amp;gt;\d+)\&amp;lt;&lt;/CODE&gt;&lt;/P&gt;

&lt;P&gt;amended to extract to "Zip"&lt;/P&gt;</description>
      <pubDate>Tue, 19 Dec 2017 20:17:03 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Help-with-regex/m-p/349624#M103492</guid>
      <dc:creator>nickhills</dc:creator>
      <dc:date>2017-12-19T20:17:03Z</dc:date>
    </item>
    <item>
      <title>Re: Help with regex</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Help-with-regex/m-p/349625#M103493</link>
      <description>&lt;P&gt;Try &lt;CODE&gt;Zip5[^&amp;gt;]+&amp;gt;([^&amp;gt;]+)&amp;lt;&lt;/CODE&gt;&lt;/P&gt;</description>
      <pubDate>Tue, 19 Dec 2017 20:30:48 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Help-with-regex/m-p/349625#M103493</guid>
      <dc:creator>micahkemp</dc:creator>
      <dc:date>2017-12-19T20:30:48Z</dc:date>
    </item>
    <item>
      <title>Re: Help with regex</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Help-with-regex/m-p/349626#M103494</link>
      <description>&lt;P&gt;Please try the following run anywhere code based on your sample data:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;| makeresults
| eval sample="&amp;lt;TargetCode key=\"Zip5\"&amp;gt;78216&amp;lt;/TargetCode&amp;gt;"
| append [| makeresults
| eval sample="&amp;lt;adm:TargetCode key=\"Zip5\" account=\"1\"&amp;gt;78216&amp;lt;/adm:TargetCode&amp;gt;"]
| rex field=sample "key=\"Zip5\".*\&amp;gt;(?&amp;lt;Zip5&amp;gt;[^\&amp;lt;]+)\&amp;lt;\/"
| table sample Zip5
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Your data seems to be xml. Any reason for not having &lt;CODE&gt;KV_MODE=xml&lt;/CODE&gt; in &lt;CODE&gt;props.conf&lt;/CODE&gt; or not using &lt;CODE&gt;spath&lt;/CODE&gt; with your raw data?&lt;/P&gt;</description>
      <pubDate>Tue, 19 Dec 2017 20:36:47 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Help-with-regex/m-p/349626#M103494</guid>
      <dc:creator>niketn</dc:creator>
      <dc:date>2017-12-19T20:36:47Z</dc:date>
    </item>
    <item>
      <title>Re: Help with regex</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Help-with-regex/m-p/349627#M103495</link>
      <description>&lt;P&gt;I want to extract the 78216 into field called ZIP&lt;/P&gt;</description>
      <pubDate>Tue, 19 Dec 2017 20:52:57 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Help-with-regex/m-p/349627#M103495</guid>
      <dc:creator>vrmandadi</dc:creator>
      <dc:date>2017-12-19T20:52:57Z</dc:date>
    </item>
    <item>
      <title>Re: Help with regex</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Help-with-regex/m-p/349628#M103496</link>
      <description>&lt;P&gt;It worked.Thanks &lt;/P&gt;</description>
      <pubDate>Tue, 19 Dec 2017 21:54:28 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Help-with-regex/m-p/349628#M103496</guid>
      <dc:creator>vrmandadi</dc:creator>
      <dc:date>2017-12-19T21:54:28Z</dc:date>
    </item>
  </channel>
</rss>

