<?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: Simple Regex in search in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/Simple-Regex-in-search/m-p/393159#M114382</link>
    <description>&lt;P&gt;Try my latest one that I edited in: &lt;CODE&gt;index=* | rex "\\(?&amp;lt;username&amp;gt;[3-5]\w+)"&lt;/CODE&gt;&lt;/P&gt;</description>
    <pubDate>Thu, 21 Feb 2019 05:16:49 GMT</pubDate>
    <dc:creator>chrisyounger</dc:creator>
    <dc:date>2019-02-21T05:16:49Z</dc:date>
    <item>
      <title>Simple Regex in search</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Simple-Regex-in-search/m-p/393156#M114379</link>
      <description>&lt;P&gt;I have a string of data that includes a field named user that has a value made up of domain\userid (eg prod\3245762 or tst\3245762 tst\smith) .  I am wanting to write a search that can pull data based on a wildcard for the domain then only detect userid starting with 3,4 or 5).&lt;BR /&gt;
I've tried  &lt;CODE&gt;index=* | rex field=user("*\\[3-5]*")&lt;/CODE&gt;&lt;BR /&gt;
and various versions of.  The majority return errors such as "...... is invalid",  "Error in Search Operator:regex"&lt;/P&gt;

&lt;P&gt;Can anyone shed some light on an appropriately formatted regex or rex statement please.&lt;/P&gt;</description>
      <pubDate>Thu, 21 Feb 2019 04:59:37 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Simple-Regex-in-search/m-p/393156#M114379</guid>
      <dc:creator>balcv</dc:creator>
      <dc:date>2019-02-21T04:59:37Z</dc:date>
    </item>
    <item>
      <title>Re: Simple Regex in search</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Simple-Regex-in-search/m-p/393157#M114380</link>
      <description>&lt;P&gt;Try this: &lt;CODE&gt;index=* | rex "\\(?&amp;lt;username&amp;gt;[3-5]\w+)"&lt;/CODE&gt;&lt;/P&gt;

&lt;P&gt;All the best&lt;/P&gt;</description>
      <pubDate>Thu, 21 Feb 2019 05:02:30 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Simple-Regex-in-search/m-p/393157#M114380</guid>
      <dc:creator>chrisyounger</dc:creator>
      <dc:date>2019-02-21T05:02:30Z</dc:date>
    </item>
    <item>
      <title>Re: Simple Regex in search</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Simple-Regex-in-search/m-p/393158#M114381</link>
      <description>&lt;P&gt;Still giving me the following error:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;Error in 'rex' command: Encountered the following error while compiling the regex '*\(?&amp;lt;username&amp;gt;[3-5]\w+)': Regex: quantifier does not follow a repeatable item
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;What I though I was needing would be &lt;EM&gt;\ for the domain wildcard, then anything **starting&lt;/EM&gt;* with 3,4 or 5 which could contain up to 7 or 8 characters.  (eg tst\326541 or prod\456987)  &lt;/P&gt;

&lt;P&gt;So something along the lines of &lt;CODE&gt;rex field=user "*\\([3-5]*")&lt;/CODE&gt; &lt;/P&gt;</description>
      <pubDate>Tue, 29 Sep 2020 23:19:08 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Simple-Regex-in-search/m-p/393158#M114381</guid>
      <dc:creator>balcv</dc:creator>
      <dc:date>2020-09-29T23:19:08Z</dc:date>
    </item>
    <item>
      <title>Re: Simple Regex in search</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Simple-Regex-in-search/m-p/393159#M114382</link>
      <description>&lt;P&gt;Try my latest one that I edited in: &lt;CODE&gt;index=* | rex "\\(?&amp;lt;username&amp;gt;[3-5]\w+)"&lt;/CODE&gt;&lt;/P&gt;</description>
      <pubDate>Thu, 21 Feb 2019 05:16:49 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Simple-Regex-in-search/m-p/393159#M114382</guid>
      <dc:creator>chrisyounger</dc:creator>
      <dc:date>2019-02-21T05:16:49Z</dc:date>
    </item>
    <item>
      <title>Re: Simple Regex in search</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Simple-Regex-in-search/m-p/393160#M114383</link>
      <description>&lt;P&gt;You can also try something more restrictive like this: &lt;CODE&gt;index=* | rex "(?:prod|tst)\\(?&amp;lt;username&amp;gt;[3-5]\w+)"&lt;/CODE&gt;&lt;/P&gt;</description>
      <pubDate>Thu, 21 Feb 2019 05:17:49 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Simple-Regex-in-search/m-p/393160#M114383</guid>
      <dc:creator>chrisyounger</dc:creator>
      <dc:date>2019-02-21T05:17:49Z</dc:date>
    </item>
    <item>
      <title>Re: Simple Regex in search</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Simple-Regex-in-search/m-p/393161#M114384</link>
      <description>&lt;P&gt;Hi @balcv&lt;/P&gt;

&lt;P&gt;Try this&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;| makeresults 
| eval user="prod\3245762;tst\3245762;tst\smith" 
| makemv delim=";" user 
| mvexpand user  | regex user="(.*)\\\([3-5][0-9]*$)"
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Thu, 21 Feb 2019 05:47:44 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Simple-Regex-in-search/m-p/393161#M114384</guid>
      <dc:creator>vnravikumar</dc:creator>
      <dc:date>2019-02-21T05:47:44Z</dc:date>
    </item>
    <item>
      <title>Re: Simple Regex in search</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Simple-Regex-in-search/m-p/393162#M114385</link>
      <description>&lt;P&gt;Hi @balcv ,&lt;/P&gt;

&lt;P&gt;Do you want something like this ....&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;Your search |  rex field=user "(?P&amp;lt;domain&amp;gt;.*)\\\\(?P&amp;lt;userid&amp;gt;.*)" 
| rex field=userid "(?P&amp;lt;userid_startingwith_3or5&amp;gt;3.+|5.+)"
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;this is a run anywhere search&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;| makeresults 
| eval user="prod\3245762;tst\3245762;tst\smith" 
| makemv delim=";" user 
| mvexpand user  | fields - _time 
| rex field=user "(?P&amp;lt;domain&amp;gt;.*)\\\\(?P&amp;lt;userid&amp;gt;.*)" 
| rex field=userid "(?P&amp;lt;userid_startingwith_3or5&amp;gt;3.+|5.+)"
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Thu, 21 Feb 2019 09:04:37 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Simple-Regex-in-search/m-p/393162#M114385</guid>
      <dc:creator>vinod94</dc:creator>
      <dc:date>2019-02-21T09:04:37Z</dc:date>
    </item>
    <item>
      <title>Re: Simple Regex in search</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Simple-Regex-in-search/m-p/393163#M114386</link>
      <description>&lt;P&gt;@balcv, resolved?&lt;/P&gt;</description>
      <pubDate>Thu, 21 Feb 2019 12:45:25 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Simple-Regex-in-search/m-p/393163#M114386</guid>
      <dc:creator>vnravikumar</dc:creator>
      <dc:date>2019-02-21T12:45:25Z</dc:date>
    </item>
    <item>
      <title>Re: Simple Regex in search</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Simple-Regex-in-search/m-p/393164#M114387</link>
      <description>&lt;P&gt;Try this:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;index=* | rex field=user "(?P&amp;lt;domain&amp;gt;^.*)\\(?P&amp;lt;userid&amp;gt;[3-5].*$)"
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;This regex retrieves only the domain\userid where userid starts with either 3, 4 or 5 and any value for domain.&lt;/P&gt;

&lt;P&gt;Hope this helps!!!&lt;/P&gt;</description>
      <pubDate>Thu, 21 Feb 2019 21:45:02 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Simple-Regex-in-search/m-p/393164#M114387</guid>
      <dc:creator>paranjith</dc:creator>
      <dc:date>2019-02-21T21:45:02Z</dc:date>
    </item>
    <item>
      <title>Re: Simple Regex in search</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Simple-Regex-in-search/m-p/393165#M114388</link>
      <description>&lt;P&gt;Thanks for your help.  All good now.&lt;/P&gt;</description>
      <pubDate>Thu, 21 Feb 2019 21:45:37 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Simple-Regex-in-search/m-p/393165#M114388</guid>
      <dc:creator>balcv</dc:creator>
      <dc:date>2019-02-21T21:45:37Z</dc:date>
    </item>
  </channel>
</rss>

