<?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 can I extract this pattern from my raw data using rex command?  \&amp;quot;ProductAccountNumber\&amp;quot;:\&amp;quot;5342534253425342\&amp;quot; in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/How-can-I-extract-this-pattern-from-my-raw-data-using-rex/m-p/308026#M92439</link>
    <description>&lt;P&gt;@tanvi1g, while the following Regular Expression worked on &lt;A href="https://regex101.com"&gt;https://regex101.com&lt;/A&gt;&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;\\\"ProductAccountNumber\\\"\:\\\"(?&amp;lt;ProductAccountNumber&amp;gt;\d+)\\\"
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;I had to introduce some extra escape characters in Splunk. Following is a run anywhere search based on your data:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;| makeresults
| eval _raw ="{ \\\"ProductAccountNumber\\\":\\\"5342534253425342\\\" }"
| rex "\\\"ProductAccountNumber\\\\\"\:\\\\\"(?&amp;lt;ProductAccountNumber&amp;gt;\d+)\\\\\""
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Please try out this rex and confirm.&lt;/P&gt;</description>
    <pubDate>Mon, 16 Oct 2017 05:23:55 GMT</pubDate>
    <dc:creator>niketn</dc:creator>
    <dc:date>2017-10-16T05:23:55Z</dc:date>
    <item>
      <title>How can I extract this pattern from my raw data using rex command?  \"ProductAccountNumber\":\"5342534253425342\"</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-can-I-extract-this-pattern-from-my-raw-data-using-rex/m-p/308024#M92437</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;

&lt;P&gt;Can someone able to help me please.&lt;/P&gt;

&lt;P&gt;I'm very new to using Splunk and most certainly to the rex command and regular expressions, so please bear with.&lt;/P&gt;

&lt;P&gt;I'm trying to extract an ProductAccountNumber field from my raw data which is in the following format&lt;BR /&gt;
 { \"ProductAccountNumber\":\"5342534253425342\"  }&lt;/P&gt;

&lt;P&gt;Could someone possibly tell me please how I may strip the actual ProductAccountNumber out of this line.&lt;/P&gt;

&lt;P&gt;Many thanks and kind regards&lt;/P&gt;

&lt;P&gt;Tanvi&lt;/P&gt;</description>
      <pubDate>Mon, 16 Oct 2017 03:50:18 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-can-I-extract-this-pattern-from-my-raw-data-using-rex/m-p/308024#M92437</guid>
      <dc:creator>tanvi1g</dc:creator>
      <dc:date>2017-10-16T03:50:18Z</dc:date>
    </item>
    <item>
      <title>Re: How can I extract this pattern from my raw data using rex command?  \"ProductAccountNumber\":\"5342534253425342\"</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-can-I-extract-this-pattern-from-my-raw-data-using-rex/m-p/308025#M92438</link>
      <description>&lt;P&gt;Please check this - &lt;BR /&gt;
&lt;CODE&gt;| makeresults &lt;BR /&gt;
     | eval _raw="{ \"ProductAccountNumber\":\"5342534253425342\" }"&lt;BR /&gt;
     | rex field=_raw "ProductAccountNumber\\\"\:\\\"(?P&amp;lt;ProdAccNo&amp;gt;\d+)" | table _raw ProdAccNo&lt;/CODE&gt;&lt;/P&gt;

&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper" image-alt="alt text"&gt;&lt;img src="https://community.splunk.com/t5/image/serverpage/image-id/3665i74C1AD65BE7CF441/image-size/large?v=v2&amp;amp;px=999" role="button" title="alt text" alt="alt text" /&gt;&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Mon, 16 Oct 2017 05:22:42 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-can-I-extract-this-pattern-from-my-raw-data-using-rex/m-p/308025#M92438</guid>
      <dc:creator>inventsekar</dc:creator>
      <dc:date>2017-10-16T05:22:42Z</dc:date>
    </item>
    <item>
      <title>Re: How can I extract this pattern from my raw data using rex command?  \"ProductAccountNumber\":\"5342534253425342\"</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-can-I-extract-this-pattern-from-my-raw-data-using-rex/m-p/308026#M92439</link>
      <description>&lt;P&gt;@tanvi1g, while the following Regular Expression worked on &lt;A href="https://regex101.com"&gt;https://regex101.com&lt;/A&gt;&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;\\\"ProductAccountNumber\\\"\:\\\"(?&amp;lt;ProductAccountNumber&amp;gt;\d+)\\\"
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;I had to introduce some extra escape characters in Splunk. Following is a run anywhere search based on your data:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;| makeresults
| eval _raw ="{ \\\"ProductAccountNumber\\\":\\\"5342534253425342\\\" }"
| rex "\\\"ProductAccountNumber\\\\\"\:\\\\\"(?&amp;lt;ProductAccountNumber&amp;gt;\d+)\\\\\""
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Please try out this rex and confirm.&lt;/P&gt;</description>
      <pubDate>Mon, 16 Oct 2017 05:23:55 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-can-I-extract-this-pattern-from-my-raw-data-using-rex/m-p/308026#M92439</guid>
      <dc:creator>niketn</dc:creator>
      <dc:date>2017-10-16T05:23:55Z</dc:date>
    </item>
  </channel>
</rss>

