<?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 help! in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/Regex-help/m-p/310046#M93033</link>
    <description>&lt;P&gt;Hi kiran331,&lt;BR /&gt;
modify regex in this way&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;(?U)(?.*)\s+(R2|Service|Enterprise)
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Are you sure to exclude R2 from your results? 2008 is really different than 2008/R2!&lt;BR /&gt;
Bye.&lt;BR /&gt;
Giuseppe&lt;/P&gt;</description>
    <pubDate>Wed, 24 May 2017 13:29:17 GMT</pubDate>
    <dc:creator>gcusello</dc:creator>
    <dc:date>2017-05-24T13:29:17Z</dc:date>
    <item>
      <title>Regex help!</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Regex-help/m-p/310040#M93027</link>
      <description>&lt;P&gt;How to use the Regex to extract the first 2 words OR 3 words from below field values?&lt;/P&gt;

&lt;P&gt;OS:&lt;BR /&gt;
Windows 10 Enterprise&lt;BR /&gt;&lt;BR /&gt;
Windows 10 Enterprise 64 bit Edition&lt;BR /&gt;&lt;BR /&gt;
Windows 2000 Service Pack 3&lt;BR /&gt;
Windows 2003 R2 Service Pack 2&lt;BR /&gt;
Windows Server 2003 R2 Service Pack 2&lt;/P&gt;

&lt;P&gt;I  need:&lt;/P&gt;

&lt;P&gt;windows 10&lt;BR /&gt;
windows 2000&lt;BR /&gt;
windows 2003&lt;BR /&gt;
windows server 2003&lt;/P&gt;</description>
      <pubDate>Wed, 24 May 2017 10:53:02 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Regex-help/m-p/310040#M93027</guid>
      <dc:creator>kiran331</dc:creator>
      <dc:date>2017-05-24T10:53:02Z</dc:date>
    </item>
    <item>
      <title>Re: Regex help!</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Regex-help/m-p/310041#M93028</link>
      <description>&lt;P&gt;Hi kiran331,&lt;BR /&gt;
try something like this&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;(?&amp;lt;SO&amp;gt;.*)\s(Enterprise|Service)
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;in a command&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;| rex field=your_field "(?&amp;lt;SO&amp;gt;.*)\s(Enterprise|Service)"
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;you can test it at &lt;A href="https://regex101.com/r/UwejCo/1"&gt;https://regex101.com/r/UwejCo/1&lt;/A&gt;&lt;/P&gt;

&lt;P&gt;Bye.&lt;BR /&gt;
Giuseppe&lt;/P&gt;</description>
      <pubDate>Wed, 24 May 2017 10:57:44 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Regex-help/m-p/310041#M93028</guid>
      <dc:creator>gcusello</dc:creator>
      <dc:date>2017-05-24T10:57:44Z</dc:date>
    </item>
    <item>
      <title>Re: Regex help!</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Regex-help/m-p/310042#M93029</link>
      <description>&lt;P&gt;Hi kiran331,&lt;BR /&gt;
try something like this&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;(?&amp;lt;SO&amp;gt;.*)\s(Enterprise|Service)
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;in a command&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;| rex field=your_field "(?&amp;lt;SO&amp;gt;.*)\s(Enterprise|Service)"
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;you can test it at &lt;A href="https://regex101.com/r/UwejCo/1"&gt;https://regex101.com/r/UwejCo/1&lt;/A&gt;&lt;/P&gt;

&lt;P&gt;Bye.&lt;BR /&gt;
Giuseppe&lt;/P&gt;</description>
      <pubDate>Wed, 24 May 2017 10:57:44 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Regex-help/m-p/310042#M93029</guid>
      <dc:creator>gcusello</dc:creator>
      <dc:date>2017-05-24T10:57:44Z</dc:date>
    </item>
    <item>
      <title>Re: Regex help!</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Regex-help/m-p/310043#M93030</link>
      <description>&lt;P&gt;Your search... | rex field=Your_OS_Field = "(?^\w*\s[\d]{2,4})"&lt;/P&gt;</description>
      <pubDate>Tue, 29 Sep 2020 14:14:25 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Regex-help/m-p/310043#M93030</guid>
      <dc:creator>damiensurat</dc:creator>
      <dc:date>2020-09-29T14:14:25Z</dc:date>
    </item>
    <item>
      <title>Re: Regex help!</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Regex-help/m-p/310044#M93031</link>
      <description>&lt;P&gt;Hi cusello.  That will work if he want a the R2, I think you should append your regex if all he is looking for is up to the version / year number. &lt;/P&gt;</description>
      <pubDate>Wed, 24 May 2017 12:11:57 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Regex-help/m-p/310044#M93031</guid>
      <dc:creator>damiensurat</dc:creator>
      <dc:date>2017-05-24T12:11:57Z</dc:date>
    </item>
    <item>
      <title>Re: Regex help!</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Regex-help/m-p/310045#M93032</link>
      <description>&lt;P&gt;Thanks cusello, Please let me know how to exclude R2 in the fields?&lt;/P&gt;</description>
      <pubDate>Wed, 24 May 2017 12:27:40 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Regex-help/m-p/310045#M93032</guid>
      <dc:creator>kiran331</dc:creator>
      <dc:date>2017-05-24T12:27:40Z</dc:date>
    </item>
    <item>
      <title>Re: Regex help!</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Regex-help/m-p/310046#M93033</link>
      <description>&lt;P&gt;Hi kiran331,&lt;BR /&gt;
modify regex in this way&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;(?U)(?.*)\s+(R2|Service|Enterprise)
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Are you sure to exclude R2 from your results? 2008 is really different than 2008/R2!&lt;BR /&gt;
Bye.&lt;BR /&gt;
Giuseppe&lt;/P&gt;</description>
      <pubDate>Wed, 24 May 2017 13:29:17 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Regex-help/m-p/310046#M93033</guid>
      <dc:creator>gcusello</dc:creator>
      <dc:date>2017-05-24T13:29:17Z</dc:date>
    </item>
    <item>
      <title>Re: Regex help!</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Regex-help/m-p/310047#M93034</link>
      <description>&lt;P&gt;Try this one,&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;... | rex  "(?&amp;lt;OS&amp;gt;[A-Z][a-z]+\s(?:\d{2,}|\w+\s\d{2,}))"
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Hope it helps.&lt;/P&gt;</description>
      <pubDate>Wed, 24 May 2017 13:52:20 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Regex-help/m-p/310047#M93034</guid>
      <dc:creator>alemarzu</dc:creator>
      <dc:date>2017-05-24T13:52:20Z</dc:date>
    </item>
    <item>
      <title>Re: Regex help!</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Regex-help/m-p/310048#M93035</link>
      <description>&lt;P&gt;I would use:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;rex field=_raw "(?&amp;lt;windows_version&amp;gt;Windows (?:Server )?[0-9]{1,4})"
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;The regex breaks down like this:&lt;BR /&gt;
Windows - exact match&lt;BR /&gt;
(?:Server )? - optional match, the space after "Server" but before the close parentheses is important.&lt;BR /&gt;
[0-9]{1,4} - match from 1 to 4 numeric characters&lt;/P&gt;

&lt;P&gt;I wouldn't extract from _raw if you have another field that includes the data, it would save some of the computational cost.&lt;/P&gt;</description>
      <pubDate>Wed, 24 May 2017 13:57:48 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Regex-help/m-p/310048#M93035</guid>
      <dc:creator>wenthold</dc:creator>
      <dc:date>2017-05-24T13:57:48Z</dc:date>
    </item>
    <item>
      <title>Re: Regex help!</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Regex-help/m-p/310049#M93036</link>
      <description>&lt;P&gt;Like this:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;| makeresults 
| eval OS="Windows 10 Enterprise 
Windows 10 Enterprise 64 bit Edition 
Windows 2000 Service Pack 3
Windows 2003 R2 Service Pack 2
Windows Server 2003 R2 Service Pack 2"
| makemv delim="
" OS

| rename COMMENT AS "Everything above creates test events; everything below is your solution"

| rex field=OS mode=sed "s/^(Windows\D+\d+).*$/\1/"
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Wed, 24 May 2017 14:42:50 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Regex-help/m-p/310049#M93036</guid>
      <dc:creator>woodcock</dc:creator>
      <dc:date>2017-05-24T14:42:50Z</dc:date>
    </item>
    <item>
      <title>Re: Regex help!</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Regex-help/m-p/310050#M93037</link>
      <description>&lt;P&gt;This is "future-proof".&lt;/P&gt;</description>
      <pubDate>Wed, 24 May 2017 16:01:34 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Regex-help/m-p/310050#M93037</guid>
      <dc:creator>woodcock</dc:creator>
      <dc:date>2017-05-24T16:01:34Z</dc:date>
    </item>
  </channel>
</rss>

