<?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: good regex (fast) in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/good-regex-fast/m-p/141278#M39133</link>
    <description>&lt;P&gt;This worked, but it is about as fast as my originally regex.&lt;/P&gt;</description>
    <pubDate>Wed, 13 Nov 2013 21:34:49 GMT</pubDate>
    <dc:creator>mcbradford</dc:creator>
    <dc:date>2013-11-13T21:34:49Z</dc:date>
    <item>
      <title>good regex (fast)</title>
      <link>https://community.splunk.com/t5/Splunk-Search/good-regex-fast/m-p/141274#M39129</link>
      <description>&lt;P&gt;I have a field called "user". I am looking for matches that contain 6 or 7 characters, and always end with "a" but does not end in "pa".&lt;/P&gt;

&lt;P&gt;I am using the following and it works, but I was wondering if someone might have a better regex expression that would be faster?&lt;/P&gt;

&lt;P&gt;regex user=".+[^p]a$"&lt;/P&gt;</description>
      <pubDate>Wed, 13 Nov 2013 18:51:22 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/good-regex-fast/m-p/141274#M39129</guid>
      <dc:creator>mcbradford</dc:creator>
      <dc:date>2013-11-13T18:51:22Z</dc:date>
    </item>
    <item>
      <title>Re: good regex (fast)</title>
      <link>https://community.splunk.com/t5/Splunk-Search/good-regex-fast/m-p/141275#M39130</link>
      <description>&lt;P&gt;I don't have data to test it but this is also an options.&lt;/P&gt;

&lt;P&gt;| where LIKE(user,"%a") AND NOT LIKE(user,"%pa")&lt;/P&gt;</description>
      <pubDate>Wed, 13 Nov 2013 19:32:24 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/good-regex-fast/m-p/141275#M39130</guid>
      <dc:creator>somesoni2</dc:creator>
      <dc:date>2013-11-13T19:32:24Z</dc:date>
    </item>
    <item>
      <title>Re: good regex (fast)</title>
      <link>https://community.splunk.com/t5/Splunk-Search/good-regex-fast/m-p/141276#M39131</link>
      <description>&lt;P&gt;Technically, your regex will match any length string that starts with at least one character followed by the letter 'a' (as end of string) without a letter 'p' coming before that letter 'a'. This means that it would match user="1a" or user="mydata" or user="my other data here a" so if you need to restrict to only a full string length of 6 or 7 characters, you are really looking for regex that looks for "5 or 6 of any character, followed by a letter 'a' to end the string, as long as there is not a letter 'p' immediately before the last letter 'a'" right?&lt;/P&gt;

&lt;P&gt;Perhaps this will work:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;^.{5,6}(a|[^p]a)$
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Wed, 13 Nov 2013 20:54:03 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/good-regex-fast/m-p/141276#M39131</guid>
      <dc:creator>jtrucks</dc:creator>
      <dc:date>2013-11-13T20:54:03Z</dc:date>
    </item>
    <item>
      <title>Re: good regex (fast)</title>
      <link>https://community.splunk.com/t5/Splunk-Search/good-regex-fast/m-p/141277#M39132</link>
      <description>&lt;P&gt;This found besmanager???&lt;/P&gt;</description>
      <pubDate>Wed, 13 Nov 2013 21:34:06 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/good-regex-fast/m-p/141277#M39132</guid>
      <dc:creator>mcbradford</dc:creator>
      <dc:date>2013-11-13T21:34:06Z</dc:date>
    </item>
    <item>
      <title>Re: good regex (fast)</title>
      <link>https://community.splunk.com/t5/Splunk-Search/good-regex-fast/m-p/141278#M39133</link>
      <description>&lt;P&gt;This worked, but it is about as fast as my originally regex.&lt;/P&gt;</description>
      <pubDate>Wed, 13 Nov 2013 21:34:49 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/good-regex-fast/m-p/141278#M39133</guid>
      <dc:creator>mcbradford</dc:creator>
      <dc:date>2013-11-13T21:34:49Z</dc:date>
    </item>
    <item>
      <title>Re: good regex (fast)</title>
      <link>https://community.splunk.com/t5/Splunk-Search/good-regex-fast/m-p/141279#M39134</link>
      <description>&lt;P&gt;Hmm. odd. I edited the entry to show string termination at the end. I don't have data in splunk to test this exact string, so it might need some tweaking. The above IS pure PCRE syntax, however. If you don't care the length of the string, your regex is perfectly fine and fast enough…&lt;/P&gt;</description>
      <pubDate>Wed, 13 Nov 2013 21:41:35 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/good-regex-fast/m-p/141279#M39134</guid>
      <dc:creator>jtrucks</dc:creator>
      <dc:date>2013-11-13T21:41:35Z</dc:date>
    </item>
    <item>
      <title>Re: good regex (fast)</title>
      <link>https://community.splunk.com/t5/Splunk-Search/good-regex-fast/m-p/141280#M39135</link>
      <description>&lt;PRE&gt;&lt;CODE&gt;^.{5,6}(?&amp;lt;!p)a$
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;should do what you want&lt;/P&gt;</description>
      <pubDate>Wed, 13 Nov 2013 21:58:00 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/good-regex-fast/m-p/141280#M39135</guid>
      <dc:creator>jgreenleaf</dc:creator>
      <dc:date>2013-11-13T21:58:00Z</dc:date>
    </item>
    <item>
      <title>Re: good regex (fast)</title>
      <link>https://community.splunk.com/t5/Splunk-Search/good-regex-fast/m-p/141281#M39136</link>
      <description>&lt;P&gt;Just a hint how to quickly test some regular expressions without having the data in splunk using eval - the examples below show tests against the regex given by jgreenleaf &lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;index=* | head 1 | eval user="12345pa" | regex user="^.{5,6}(?&amp;lt;!p)a$" | table user

index=* | head 1 | eval user="123456a" | regex user="^.{5,6}(?&amp;lt;!p)a$" | table user
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Wed, 13 Nov 2013 23:01:44 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/good-regex-fast/m-p/141281#M39136</guid>
      <dc:creator>tpflicke</dc:creator>
      <dc:date>2013-11-13T23:01:44Z</dc:date>
    </item>
  </channel>
</rss>

