<?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 do a field extraction on the date string of a Windows source path field? in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/How-to-do-a-field-extraction-on-the-date-string-of-a-Windows/m-p/109370#M28524</link>
    <description>&lt;P&gt;I believe there are two errors in your expression: a) you need to escape your backslashes, and b) you did not give your capture group a name. I can reccomend &lt;A href="https://regex101.com/"&gt;https://regex101.com/&lt;/A&gt; to confirm your regular expressions.&lt;/P&gt;

&lt;P&gt;In your case, your path contains double backslashes and you need to escape both of them, so your regex looks like &lt;CODE&gt;| rex field=source "G:\\\\OperationData\\\\Ntr_RdngANI\\\\Work_Bill\\\\Dis_Rec\\\\03_12\\\\Fun_(?\d+)_successful.txt"&lt;/CODE&gt; - the &lt;CODE&gt;capture&lt;/CODE&gt; in angular brackets being the name of your capture group, and &lt;CODE&gt;\\\\&lt;/CODE&gt; as a literal &lt;CODE&gt;\\&lt;/CODE&gt;.&lt;/P&gt;

&lt;P&gt;Hope this helps. And you should really give the page mentioned above a try!&lt;/P&gt;</description>
    <pubDate>Thu, 26 Mar 2015 07:20:42 GMT</pubDate>
    <dc:creator>jeffland</dc:creator>
    <dc:date>2015-03-26T07:20:42Z</dc:date>
    <item>
      <title>How to do a field extraction on the date string of a Windows source path field?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-do-a-field-extraction-on-the-date-string-of-a-Windows/m-p/109369#M28523</link>
      <description>&lt;P&gt;Hi All&lt;/P&gt;

&lt;P&gt;I have here a sample source path: &lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;source="G:\\OperationData\\Ntr_RdngANI\\Work_Bill\\Dis_Rec\\03_12\\Fun_20150312_successful.txt"
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;I want to extact the &lt;CODE&gt;20150312&lt;/CODE&gt;&lt;/P&gt;

&lt;P&gt;how can I do that?&lt;BR /&gt;
I already tried &lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;|rex field=source "G:\\OperationData\\Ntr_RdngANI\\Work_Bill\\Dis_Rec\\03_12\\Fun_(?\d+)_successful.txt"
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;but it doesn't work, I think its about the &lt;CODE&gt;"\"&lt;/CODE&gt;&lt;/P&gt;

&lt;P&gt;can someone help me with this?&lt;BR /&gt;
Thanks!&lt;/P&gt;</description>
      <pubDate>Thu, 26 Mar 2015 06:41:16 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-do-a-field-extraction-on-the-date-string-of-a-Windows/m-p/109369#M28523</guid>
      <dc:creator>shariinPH</dc:creator>
      <dc:date>2015-03-26T06:41:16Z</dc:date>
    </item>
    <item>
      <title>Re: How to do a field extraction on the date string of a Windows source path field?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-do-a-field-extraction-on-the-date-string-of-a-Windows/m-p/109370#M28524</link>
      <description>&lt;P&gt;I believe there are two errors in your expression: a) you need to escape your backslashes, and b) you did not give your capture group a name. I can reccomend &lt;A href="https://regex101.com/"&gt;https://regex101.com/&lt;/A&gt; to confirm your regular expressions.&lt;/P&gt;

&lt;P&gt;In your case, your path contains double backslashes and you need to escape both of them, so your regex looks like &lt;CODE&gt;| rex field=source "G:\\\\OperationData\\\\Ntr_RdngANI\\\\Work_Bill\\\\Dis_Rec\\\\03_12\\\\Fun_(?\d+)_successful.txt"&lt;/CODE&gt; - the &lt;CODE&gt;capture&lt;/CODE&gt; in angular brackets being the name of your capture group, and &lt;CODE&gt;\\\\&lt;/CODE&gt; as a literal &lt;CODE&gt;\\&lt;/CODE&gt;.&lt;/P&gt;

&lt;P&gt;Hope this helps. And you should really give the page mentioned above a try!&lt;/P&gt;</description>
      <pubDate>Thu, 26 Mar 2015 07:20:42 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-do-a-field-extraction-on-the-date-string-of-a-Windows/m-p/109370#M28524</guid>
      <dc:creator>jeffland</dc:creator>
      <dc:date>2015-03-26T07:20:42Z</dc:date>
    </item>
    <item>
      <title>Re: How to do a field extraction on the date string of a Windows source path field?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-do-a-field-extraction-on-the-date-string-of-a-Windows/m-p/109371#M28525</link>
      <description>&lt;P&gt;Hi shariin,&lt;/P&gt;

&lt;P&gt;What jeffland said about double backslashes and naming your capturing group was correct. Instead of using the full path as regex pattern, why don't you focus on the file name instead?  Something like this:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;Fun_(?&amp;lt;DateLog&amp;gt;\d{8})_.*
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;I've tested it and you can get what you wanted.&lt;/P&gt;</description>
      <pubDate>Thu, 26 Mar 2015 09:32:37 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-do-a-field-extraction-on-the-date-string-of-a-Windows/m-p/109371#M28525</guid>
      <dc:creator>vincenteous</dc:creator>
      <dc:date>2015-03-26T09:32:37Z</dc:date>
    </item>
    <item>
      <title>Re: How to do a field extraction on the date string of a Windows source path field?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-do-a-field-extraction-on-the-date-string-of-a-Windows/m-p/109372#M28526</link>
      <description>&lt;P&gt;^Easiest solution&lt;/P&gt;</description>
      <pubDate>Thu, 26 Mar 2015 13:21:26 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-do-a-field-extraction-on-the-date-string-of-a-Windows/m-p/109372#M28526</guid>
      <dc:creator>masonmorales</dc:creator>
      <dc:date>2015-03-26T13:21:26Z</dc:date>
    </item>
    <item>
      <title>Re: How to do a field extraction on the date string of a Windows source path field?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-do-a-field-extraction-on-the-date-string-of-a-Windows/m-p/109373#M28527</link>
      <description>&lt;P&gt;Yes! This works! Thanks!! &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Mon, 30 Mar 2015 07:25:16 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-do-a-field-extraction-on-the-date-string-of-a-Windows/m-p/109373#M28527</guid>
      <dc:creator>shariinPH</dc:creator>
      <dc:date>2015-03-30T07:25:16Z</dc:date>
    </item>
    <item>
      <title>Re: How to do a field extraction on the date string of a Windows source path field?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-do-a-field-extraction-on-the-date-string-of-a-Windows/m-p/109374#M28528</link>
      <description>&lt;P&gt;Hello @jeffland .. This works too ! &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt; thanks!! &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Mon, 30 Mar 2015 07:26:03 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-do-a-field-extraction-on-the-date-string-of-a-Windows/m-p/109374#M28528</guid>
      <dc:creator>shariinPH</dc:creator>
      <dc:date>2015-03-30T07:26:03Z</dc:date>
    </item>
  </channel>
</rss>

