<?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: Splunk regex error: Missing terminating ] for character class in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/Splunk-regex-error-Missing-terminating-for-character-class/m-p/494902#M137952</link>
    <description>&lt;P&gt;sorry, did you tried with &lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;| rex field=source "\\(?&amp;lt;log_name&amp;gt;\w+\.\w+)$"
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;?&lt;BR /&gt;
As you can see in regex101, it extracts all the requested filenames that are after tha last backslash.&lt;/P&gt;

&lt;P&gt;Bye.&lt;BR /&gt;
Giuseppe&lt;/P&gt;</description>
    <pubDate>Thu, 10 Oct 2019 15:13:15 GMT</pubDate>
    <dc:creator>gcusello</dc:creator>
    <dc:date>2019-10-10T15:13:15Z</dc:date>
    <item>
      <title>Splunk regex error: Missing terminating ] for character class</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Splunk-regex-error-Missing-terminating-for-character-class/m-p/494898#M137948</link>
      <description>&lt;P&gt;Hey Splunkers,&lt;/P&gt;

&lt;P&gt;Noob. Trying to only retrieve the log names (ex. utility.log) after the last slash&lt;/P&gt;

&lt;P&gt;&lt;STRONG&gt;blah\blah\blah\logs\error.log&lt;BR /&gt;
blah\blah\blah\logs\audit.log&lt;BR /&gt;
blah\blah\blah\logs\utility.log&lt;BR /&gt;
blah\blah\blah\logs\service.log&lt;BR /&gt;
blah\blah\blah\logs\servlet.log&lt;/STRONG&gt;&lt;/P&gt;

&lt;P&gt;Does anyone have any ideas as to why my regex returns the error below? Thanks all!&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;| rex field=source "\\\([^\\\]+)$"
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Error in 'rex' command: Encountered the following error while compiling the regex '([^]+)$': Regex: missing terminating ] for character class.&lt;/P&gt;

&lt;P&gt;P.S. The regex I am using above worked on regex 101&lt;/P&gt;</description>
      <pubDate>Thu, 10 Oct 2019 12:31:26 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Splunk-regex-error-Missing-terminating-for-character-class/m-p/494898#M137948</guid>
      <dc:creator>spluzer</dc:creator>
      <dc:date>2019-10-10T12:31:26Z</dc:date>
    </item>
    <item>
      <title>Re: Splunk regex error: Missing terminating ] for character class</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Splunk-regex-error-Missing-terminating-for-character-class/m-p/494899#M137949</link>
      <description>&lt;H5&gt;CORRECTION&lt;/H5&gt;

&lt;P&gt;Some text got cut out in posting&lt;BR /&gt;
MY SPLUNK QUERY/REGEX IS THIS:&lt;/P&gt;

&lt;P&gt;| rex field=source "\([^\]+)$"&lt;/P&gt;</description>
      <pubDate>Thu, 10 Oct 2019 12:37:56 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Splunk-regex-error-Missing-terminating-for-character-class/m-p/494899#M137949</guid>
      <dc:creator>spluzer</dc:creator>
      <dc:date>2019-10-10T12:37:56Z</dc:date>
    </item>
    <item>
      <title>Re: Splunk regex error: Missing terminating ] for character class</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Splunk-regex-error-Missing-terminating-for-character-class/m-p/494900#M137950</link>
      <description>&lt;P&gt;Hi spluzer,&lt;BR /&gt;
try this&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;\\(?&amp;lt;log_name&amp;gt;\w+\.\w+)$
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;that you can test at &lt;A href="https://regex101.com/r/kUsfJu/1"&gt;https://regex101.com/r/kUsfJu/1&lt;/A&gt;&lt;/P&gt;

&lt;P&gt;Bye.&lt;BR /&gt;
Giuseppe&lt;/P&gt;</description>
      <pubDate>Thu, 10 Oct 2019 13:16:36 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Splunk-regex-error-Missing-terminating-for-character-class/m-p/494900#M137950</guid>
      <dc:creator>gcusello</dc:creator>
      <dc:date>2019-10-10T13:16:36Z</dc:date>
    </item>
    <item>
      <title>Re: Splunk regex error: Missing terminating ] for character class</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Splunk-regex-error-Missing-terminating-for-character-class/m-p/494901#M137951</link>
      <description>&lt;P&gt;Sorry, I should have been more clear. I need to capture everything after the last slash for all 5 logs.  &lt;/P&gt;

&lt;P&gt;error.log&lt;BR /&gt;
audit.log&lt;BR /&gt;
utility.log&lt;BR /&gt;
service.log&lt;BR /&gt;
servlet.log&lt;/P&gt;

&lt;P&gt;Moreover, I couldn't get what you sent (entering the log name in individually) to work in regex 101 or splunk.  &lt;/P&gt;

&lt;P&gt;Thanks!&lt;/P&gt;</description>
      <pubDate>Thu, 10 Oct 2019 15:05:55 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Splunk-regex-error-Missing-terminating-for-character-class/m-p/494901#M137951</guid>
      <dc:creator>spluzer</dc:creator>
      <dc:date>2019-10-10T15:05:55Z</dc:date>
    </item>
    <item>
      <title>Re: Splunk regex error: Missing terminating ] for character class</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Splunk-regex-error-Missing-terminating-for-character-class/m-p/494902#M137952</link>
      <description>&lt;P&gt;sorry, did you tried with &lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;| rex field=source "\\(?&amp;lt;log_name&amp;gt;\w+\.\w+)$"
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;?&lt;BR /&gt;
As you can see in regex101, it extracts all the requested filenames that are after tha last backslash.&lt;/P&gt;

&lt;P&gt;Bye.&lt;BR /&gt;
Giuseppe&lt;/P&gt;</description>
      <pubDate>Thu, 10 Oct 2019 15:13:15 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Splunk-regex-error-Missing-terminating-for-character-class/m-p/494902#M137952</guid>
      <dc:creator>gcusello</dc:creator>
      <dc:date>2019-10-10T15:13:15Z</dc:date>
    </item>
    <item>
      <title>Re: Splunk regex error: Missing terminating ] for character class</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Splunk-regex-error-Missing-terminating-for-character-class/m-p/494903#M137953</link>
      <description>&lt;P&gt;Thanks. it required 3 slashes after the first quote.. and then it worked..thanks again!  For some reason the 3rd slash (which I assume you posted) gets cut off when posting to the forum &lt;/P&gt;

&lt;P&gt;| rex field=source "\(?\w+.\w+)$"&lt;/P&gt;</description>
      <pubDate>Thu, 10 Oct 2019 15:31:14 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Splunk-regex-error-Missing-terminating-for-character-class/m-p/494903#M137953</guid>
      <dc:creator>spluzer</dc:creator>
      <dc:date>2019-10-10T15:31:14Z</dc:date>
    </item>
    <item>
      <title>Re: Splunk regex error: Missing terminating ] for character class</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Splunk-regex-error-Missing-terminating-for-character-class/m-p/494904#M137954</link>
      <description>&lt;P&gt;lol...it did it again !! THIS IS THE CORRECT ONE:&lt;/P&gt;

&lt;P&gt;| rex field=source "\\(?\w+.\w+)$"&lt;/P&gt;</description>
      <pubDate>Thu, 10 Oct 2019 15:33:47 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Splunk-regex-error-Missing-terminating-for-character-class/m-p/494904#M137954</guid>
      <dc:creator>spluzer</dc:creator>
      <dc:date>2019-10-10T15:33:47Z</dc:date>
    </item>
    <item>
      <title>Re: Splunk regex error: Missing terminating ] for character class</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Splunk-regex-error-Missing-terminating-for-character-class/m-p/494905#M137955</link>
      <description>&lt;P&gt;| rex field=source "\\(?\w+.\w+)$"&lt;/P&gt;</description>
      <pubDate>Thu, 10 Oct 2019 15:35:19 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Splunk-regex-error-Missing-terminating-for-character-class/m-p/494905#M137955</guid>
      <dc:creator>spluzer</dc:creator>
      <dc:date>2019-10-10T15:35:19Z</dc:date>
    </item>
    <item>
      <title>Re: Splunk regex error: Missing terminating ] for character class</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Splunk-regex-error-Missing-terminating-for-character-class/m-p/494906#M137956</link>
      <description>&lt;P&gt;| rex field=source "\\(?\w+.\w+)$&lt;/P&gt;</description>
      <pubDate>Thu, 10 Oct 2019 15:36:33 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Splunk-regex-error-Missing-terminating-for-character-class/m-p/494906#M137956</guid>
      <dc:creator>spluzer</dc:creator>
      <dc:date>2019-10-10T15:36:33Z</dc:date>
    </item>
    <item>
      <title>Re: Splunk regex error: Missing terminating ] for character class</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Splunk-regex-error-Missing-terminating-for-character-class/m-p/494907#M137957</link>
      <description>&lt;P&gt;lol...oh well i guess i cant post the correct code. it keeps getting overwritten during posting . anyway thanks Giuseppe. what you have is correct it just requires 3 slashes after the first quote &lt;/P&gt;</description>
      <pubDate>Thu, 10 Oct 2019 15:38:38 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Splunk-regex-error-Missing-terminating-for-character-class/m-p/494907#M137957</guid>
      <dc:creator>spluzer</dc:creator>
      <dc:date>2019-10-10T15:38:38Z</dc:date>
    </item>
  </channel>
</rss>

