<?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: rex capture groups - windows file name and path in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/rex-capture-groups-windows-file-name-and-path/m-p/380451#M111341</link>
    <description>&lt;P&gt;Ah, thanks xpac...&lt;/P&gt;

&lt;P&gt;This is the change, and now works.&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt; rex field=test "(?&amp;lt;Path&amp;gt;^.+\\\)(?&amp;lt;File&amp;gt;[^\\\]+\.\w+$)"
&lt;/CODE&gt;&lt;/PRE&gt;</description>
    <pubDate>Mon, 11 Jun 2018 20:13:19 GMT</pubDate>
    <dc:creator>brdr</dc:creator>
    <dc:date>2018-06-11T20:13:19Z</dc:date>
    <item>
      <title>rex capture groups - windows file name and path</title>
      <link>https://community.splunk.com/t5/Splunk-Search/rex-capture-groups-windows-file-name-and-path/m-p/380449#M111339</link>
      <description>&lt;P&gt;I'm attempting to capture 2 groups; a windows path and filename. I've successfully written the rex syntax and it works using  &lt;STRONG&gt;strong text&lt;/STRONG&gt;regex101.com*&lt;EM&gt;strong text&lt;/EM&gt;* app. &lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;| makeresults
| eval test="C:\WINDOWS\TEMP\ABCDE\HELP_WITHREX_64.EXE"
| rex field=test "(?&amp;lt;Path&amp;gt;^.+\\)(?&amp;lt;File&amp;gt;[^\\]+\.\w+$)"
| table Path File
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;However, when I use in Splunk I get an error "Regex: missing terminating ] for character class." Any idea why? thx.&lt;/P&gt;</description>
      <pubDate>Tue, 29 Sep 2020 19:58:09 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/rex-capture-groups-windows-file-name-and-path/m-p/380449#M111339</guid>
      <dc:creator>brdr</dc:creator>
      <dc:date>2020-09-29T19:58:09Z</dc:date>
    </item>
    <item>
      <title>Re: rex capture groups - windows file name and path</title>
      <link>https://community.splunk.com/t5/Splunk-Search/rex-capture-groups-windows-file-name-and-path/m-p/380450#M111340</link>
      <description>&lt;P&gt;Yeah, the &lt;CODE&gt;| rex&lt;/CODE&gt; command is a little tricky, as stuff has to be double-escaped. Try replacing &lt;CODE&gt;\\&lt;/CODE&gt; with &lt;CODE&gt;\\\&lt;/CODE&gt; - that should work.&lt;BR /&gt;
Hint: This is usually not necessary in config files, but in searches, as those have to be escaped once for the SPL parser and once for the regex parser.&lt;/P&gt;

&lt;P&gt;Hope that helps - if it does I'd be happy if you would upvote/accept this answer, so others could profit from it. &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Mon, 11 Jun 2018 19:54:03 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/rex-capture-groups-windows-file-name-and-path/m-p/380450#M111340</guid>
      <dc:creator>xpac</dc:creator>
      <dc:date>2018-06-11T19:54:03Z</dc:date>
    </item>
    <item>
      <title>Re: rex capture groups - windows file name and path</title>
      <link>https://community.splunk.com/t5/Splunk-Search/rex-capture-groups-windows-file-name-and-path/m-p/380451#M111341</link>
      <description>&lt;P&gt;Ah, thanks xpac...&lt;/P&gt;

&lt;P&gt;This is the change, and now works.&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt; rex field=test "(?&amp;lt;Path&amp;gt;^.+\\\)(?&amp;lt;File&amp;gt;[^\\\]+\.\w+$)"
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Mon, 11 Jun 2018 20:13:19 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/rex-capture-groups-windows-file-name-and-path/m-p/380451#M111341</guid>
      <dc:creator>brdr</dc:creator>
      <dc:date>2018-06-11T20:13:19Z</dc:date>
    </item>
  </channel>
</rss>

