<?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: Regex issue in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/Regex-issue/m-p/100230#M25921</link>
    <description>&lt;P&gt;Thanks, I copied your regex exactly, quotes and all, but I am still getting the below error with the suggested regex.&lt;BR /&gt;
Error in 'rex' command: Encountered the following error while compiling the regex '[a-zA-Z]{1}:\w+\w+(?P&lt;MAP&gt;&lt;AREA /&gt;\w+\w+)': Regex: unmatched parentheses&lt;/MAP&gt;&lt;/P&gt;</description>
    <pubDate>Wed, 11 May 2011 20:21:33 GMT</pubDate>
    <dc:creator>approachct</dc:creator>
    <dc:date>2011-05-11T20:21:33Z</dc:date>
    <item>
      <title>Regex issue</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Regex-issue/m-p/100228#M25919</link>
      <description>&lt;P&gt;Having trouble with the below regex generated from the field extractor application&lt;BR /&gt;
\w+:\\w+\\w+\(?P&lt;MAP&gt;&lt;AREA /&gt;\w+\\w+)&lt;/MAP&gt;&lt;/P&gt;

&lt;P&gt;When added to the search as below &lt;BR /&gt;
index=utility sourcetype="componentcheck"|rex field=FILENAME \w+:\\w+\\w+\(?P&lt;MAP&gt;&lt;AREA /&gt;\w+\\w+) &lt;/MAP&gt;&lt;/P&gt;

&lt;P&gt;and example input of &lt;BR /&gt;
d:\A\B\C\D\E\F.dll (there are back slashes between each letter)&lt;/P&gt;

&lt;P&gt;I get an two of the same errors -&lt;BR /&gt;
Error in 'rex' command: Encountered the following error while compiling the regex '\w+:\w+\w+(?P&lt;MAP&gt;&lt;AREA /&gt;\w+\w+)': Regex: unmatched parentheses&lt;/MAP&gt;&lt;/P&gt;

&lt;P&gt;What am I doing wrong?&lt;/P&gt;</description>
      <pubDate>Wed, 11 May 2011 19:52:20 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Regex-issue/m-p/100228#M25919</guid>
      <dc:creator>approachct</dc:creator>
      <dc:date>2011-05-11T19:52:20Z</dc:date>
    </item>
    <item>
      <title>Re: Regex issue</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Regex-issue/m-p/100229#M25920</link>
      <description>&lt;P&gt;I would write this a bit differently, more importantly you seem to be missing a backslash before your word-ish chunk after your field name &lt;CODE&gt;(?P&amp;lt;area&amp;gt;\w+\w+)&lt;/CODE&gt;&lt;/P&gt;

&lt;P&gt;Additionally, you might get it to evaluate a bit better if you write it this way:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;[a-zA-Z]{1}\:\\\w+\\\w+\\(?P&amp;lt;area&amp;gt;\w+\\\w+)
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;I'm not sure if that's what you're trying to extract, but you get the general idea.  And maybe I'm just a creature of habit but I like to put double quotes around my regex:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;index=utility sourcetype="componentcheck"|rex field=FILENAME "[a-zA-Z]{1}\:\\\w+\\\w+\\(?P&amp;lt;area&amp;gt;\w+\\\w+)"
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Wed, 11 May 2011 20:15:22 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Regex-issue/m-p/100229#M25920</guid>
      <dc:creator>Lamar</dc:creator>
      <dc:date>2011-05-11T20:15:22Z</dc:date>
    </item>
    <item>
      <title>Re: Regex issue</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Regex-issue/m-p/100230#M25921</link>
      <description>&lt;P&gt;Thanks, I copied your regex exactly, quotes and all, but I am still getting the below error with the suggested regex.&lt;BR /&gt;
Error in 'rex' command: Encountered the following error while compiling the regex '[a-zA-Z]{1}:\w+\w+(?P&lt;MAP&gt;&lt;AREA /&gt;\w+\w+)': Regex: unmatched parentheses&lt;/MAP&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 11 May 2011 20:21:33 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Regex-issue/m-p/100230#M25921</guid>
      <dc:creator>approachct</dc:creator>
      <dc:date>2011-05-11T20:21:33Z</dc:date>
    </item>
    <item>
      <title>Re: Regex issue</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Regex-issue/m-p/100231#M25922</link>
      <description>&lt;P&gt;The "indexer/search head" is on Windows...yes?&lt;/P&gt;</description>
      <pubDate>Wed, 11 May 2011 20:32:58 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Regex-issue/m-p/100231#M25922</guid>
      <dc:creator>Lamar</dc:creator>
      <dc:date>2011-05-11T20:32:58Z</dc:date>
    </item>
    <item>
      <title>Re: Regex issue</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Regex-issue/m-p/100232#M25923</link>
      <description>&lt;P&gt;No the indexer is Linux&lt;/P&gt;</description>
      <pubDate>Thu, 12 May 2011 15:34:44 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Regex-issue/m-p/100232#M25923</guid>
      <dc:creator>approachct</dc:creator>
      <dc:date>2011-05-12T15:34:44Z</dc:date>
    </item>
    <item>
      <title>Re: Regex issue</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Regex-issue/m-p/100233#M25924</link>
      <description>&lt;P&gt;The confusing/awkward bit is the escaping of backslash in regular expressions, see &lt;A href="http://answers.splunk.com/answers/29802/quadruple-backslash-required-bug-or-feature"&gt;here&lt;/A&gt;, in short to match a literal &lt;CODE&gt;\&lt;/CODE&gt; you need &lt;CODE&gt;\\\\&lt;/CODE&gt; &lt;/P&gt;

&lt;P&gt;Below are a couple of solutions of how to extract the basename - anything surrounding the rex clause if just test framework.&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;| metadata type=sourcetypes | head 1 | eval FILENAME="d:\\A\\B\\C\\D\\E\\F.dll"  | rex field=FILENAME "[a-z]:.*\\\\(?&amp;lt;area&amp;gt;\w+\.\w+)" | table FILENAME, area

| metadata type=sourcetypes | head 1 | eval FILENAME="d:\\A\\B\\C\\D\\E\\F.dll"  | rex field=FILENAME "[a-zA-Z]\:\\\\(\w+\\\\)*(?&amp;lt;area&amp;gt;\w+\.\w+)" | table FILENAME, area
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Sun, 24 Nov 2013 15:03:54 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Regex-issue/m-p/100233#M25924</guid>
      <dc:creator>tpflicke</dc:creator>
      <dc:date>2013-11-24T15:03:54Z</dc:date>
    </item>
    <item>
      <title>Re: Regex issue</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Regex-issue/m-p/100234#M25925</link>
      <description>&lt;P&gt;The first parenthesis is escaped: ( &lt;BR /&gt;
The regex engine thinks that there is an unmatched closing parenthesis at the end of your expression. &lt;/P&gt;</description>
      <pubDate>Thu, 28 Dec 2017 20:00:56 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Regex-issue/m-p/100234#M25925</guid>
      <dc:creator>cstump_splunk</dc:creator>
      <dc:date>2017-12-28T20:00:56Z</dc:date>
    </item>
    <item>
      <title>Re: Regex issue</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Regex-issue/m-p/100235#M25926</link>
      <description>&lt;P&gt;Sample regex has many issues:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;\w+:\\\w+\\\w+\(?P\w+\\\w+)
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;While the sample regex fails to escape the backslash correctly or name the capture group, here is what I think that you are trying to match:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;| stats count | eval FILENAME="d:\\A\\B\\C\\D\\E\\F.dll"  | rex field=FILENAME "(\w+[\:\\\]+){3}(?&amp;lt;my_field&amp;gt;\w+\\\+\w+)" | table FILENAME, my_field
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Tue, 04 Sep 2018 16:51:06 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Regex-issue/m-p/100235#M25926</guid>
      <dc:creator>landen99</dc:creator>
      <dc:date>2018-09-04T16:51:06Z</dc:date>
    </item>
    <item>
      <title>Re: Regex issue</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Regex-issue/m-p/100236#M25927</link>
      <description>&lt;P&gt;Try this:-&lt;/P&gt;

&lt;P&gt;"[a-zA-Z]:(?:(?:\\[a-zA-Z]){5}\\)(?P[a-zA-Z].\w+)"&lt;/P&gt;</description>
      <pubDate>Sat, 09 Feb 2019 10:14:52 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Regex-issue/m-p/100236#M25927</guid>
      <dc:creator>kushagra9120</dc:creator>
      <dc:date>2019-02-09T10:14:52Z</dc:date>
    </item>
  </channel>
</rss>

