<?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: Another regex issue in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/Another-regex-issue/m-p/315445#M94426</link>
    <description>&lt;P&gt;The rex needs the name of the field you are making. So try something like:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;sourcetype=WinEventLog:Security host=* | rex field=EventCode "(?P&amp;lt;EventID&amp;gt;(486[8-9]|48[7-9][0-9]|4900))"
&lt;/CODE&gt;&lt;/PRE&gt;</description>
    <pubDate>Tue, 18 Jul 2017 15:05:46 GMT</pubDate>
    <dc:creator>cpetterborg</dc:creator>
    <dc:date>2017-07-18T15:05:46Z</dc:date>
    <item>
      <title>Another regex issue</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Another-regex-issue/m-p/315443#M94424</link>
      <description>&lt;P&gt;I'm trying to collate groups of Windows EventIDs into categories and use regex to filter a range of them.  I cannot get this to work, either I get errors saying the regex cannot do anything or I get all EventIDs like the regex was completely ignored.  Here's an example:  EventIDs 4868-4900 are for MS Certificate Services, so I'd like to find all of them and create an eventtype for that.  Here is my search string:&lt;/P&gt;

&lt;P&gt;sourcetype=WinEventLog:Security host=* | rex field=EventCode "(486[8-9]|48[7-9][0-9]|4900)"&lt;/P&gt;

&lt;P&gt;Please help... I'm new to regex and so far hate it &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Tue, 18 Jul 2017 14:30:06 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Another-regex-issue/m-p/315443#M94424</guid>
      <dc:creator>ldgrube</dc:creator>
      <dc:date>2017-07-18T14:30:06Z</dc:date>
    </item>
    <item>
      <title>Re: Another regex issue</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Another-regex-issue/m-p/315444#M94425</link>
      <description>&lt;P&gt;I think you're using the wrong command.  The &lt;CODE&gt;rex&lt;/CODE&gt; command extracts data from a field using regular expressions.  To filter events using a regular expression, try the &lt;CODE&gt;regex&lt;/CODE&gt; command.&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;sourcetype=WinEventLog:Security host=* | regex field=EventCode "(486[8-9]|48[7-9][0-9]|4900)"
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Tue, 18 Jul 2017 15:02:21 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Another-regex-issue/m-p/315444#M94425</guid>
      <dc:creator>richgalloway</dc:creator>
      <dc:date>2017-07-18T15:02:21Z</dc:date>
    </item>
    <item>
      <title>Re: Another regex issue</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Another-regex-issue/m-p/315445#M94426</link>
      <description>&lt;P&gt;The rex needs the name of the field you are making. So try something like:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;sourcetype=WinEventLog:Security host=* | rex field=EventCode "(?P&amp;lt;EventID&amp;gt;(486[8-9]|48[7-9][0-9]|4900))"
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Tue, 18 Jul 2017 15:05:46 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Another-regex-issue/m-p/315445#M94426</guid>
      <dc:creator>cpetterborg</dc:creator>
      <dc:date>2017-07-18T15:05:46Z</dc:date>
    </item>
    <item>
      <title>Re: Another regex issue</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Another-regex-issue/m-p/315446#M94427</link>
      <description>&lt;P&gt;that is getting closer... at least I get data now... I'm just getting too many codes that don't fit between those numbers 4868-4900.&lt;/P&gt;

&lt;P&gt;anything like:&lt;BR /&gt;
1....538...540....56x,...57x..... 46xx......47xx......48xx.....49xxxx.... 50xx.....51xx.....61xx.....62xx.....82xx&lt;/P&gt;

&lt;P&gt;tried many variations of something like:&lt;/P&gt;

&lt;P&gt;sourcetype=WinEventLog:Security host=* | rex field=EventCode "(?P((48(6[8-9])|[7-9][0-9])|4900))"&lt;/P&gt;

&lt;P&gt;if I dump:      (48(6[8-9])|[7-9][0-9])|4900   into an online regex tester...it gives me the right range  4868-4900... I'm not sure where I'm causing splunk grief in the syntax &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Tue, 18 Jul 2017 20:06:21 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Another-regex-issue/m-p/315446#M94427</guid>
      <dc:creator>ldgrube</dc:creator>
      <dc:date>2017-07-18T20:06:21Z</dc:date>
    </item>
    <item>
      <title>Re: Another regex issue</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Another-regex-issue/m-p/315447#M94428</link>
      <description>&lt;P&gt;Why using rex / regex at all? If EventCode is integer already, just use the rangemap command.&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;| makeresults | eval EventCode="12,4868,5000,4900" | makemv delim="," EventCode | mvexpand EventCode
 | rangemap field=EventCode lower_end=0-4867 "MS Cert"=4868-4900 upper_end=4901-99999 
| search range="MS Cert"
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;gives you back 4868 and 4900 from  the test input.&lt;/P&gt;</description>
      <pubDate>Wed, 19 Jul 2017 11:08:04 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Another-regex-issue/m-p/315447#M94428</guid>
      <dc:creator>knielsen</dc:creator>
      <dc:date>2017-07-19T11:08:04Z</dc:date>
    </item>
  </channel>
</rss>

