<?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 REX Non-Capture Group in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/REX-Non-Capture-Group/m-p/303660#M91345</link>
    <description>&lt;P&gt;Hi Everyone, &lt;/P&gt;

&lt;P&gt;Trying to understand non-capture groups better&lt;/P&gt;

&lt;P&gt;Trying to build  rex that captures 2 conditions but uses a non-capture for condition one. &lt;/P&gt;

&lt;P&gt;&lt;STRONG&gt;Condition one (non capture):&lt;/STRONG&gt; Non Capture Message= but capture everything after (Message=)&lt;/P&gt;

&lt;P&gt;&lt;STRONG&gt;Condition two:&lt;/STRONG&gt; Everything after (:\d:)&lt;/P&gt;

&lt;P&gt;Here's what I ended up with but "Message" still shows up in the results:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;    | rex "(?i)(?P&amp;lt;TEST&amp;gt;((:\d:)|(?:(Message\=)))[^\$]*)" 
&lt;/CODE&gt;&lt;/PRE&gt;</description>
    <pubDate>Tue, 28 Mar 2017 20:44:39 GMT</pubDate>
    <dc:creator>subtrakt</dc:creator>
    <dc:date>2017-03-28T20:44:39Z</dc:date>
    <item>
      <title>REX Non-Capture Group</title>
      <link>https://community.splunk.com/t5/Splunk-Search/REX-Non-Capture-Group/m-p/303660#M91345</link>
      <description>&lt;P&gt;Hi Everyone, &lt;/P&gt;

&lt;P&gt;Trying to understand non-capture groups better&lt;/P&gt;

&lt;P&gt;Trying to build  rex that captures 2 conditions but uses a non-capture for condition one. &lt;/P&gt;

&lt;P&gt;&lt;STRONG&gt;Condition one (non capture):&lt;/STRONG&gt; Non Capture Message= but capture everything after (Message=)&lt;/P&gt;

&lt;P&gt;&lt;STRONG&gt;Condition two:&lt;/STRONG&gt; Everything after (:\d:)&lt;/P&gt;

&lt;P&gt;Here's what I ended up with but "Message" still shows up in the results:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;    | rex "(?i)(?P&amp;lt;TEST&amp;gt;((:\d:)|(?:(Message\=)))[^\$]*)" 
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Tue, 28 Mar 2017 20:44:39 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/REX-Non-Capture-Group/m-p/303660#M91345</guid>
      <dc:creator>subtrakt</dc:creator>
      <dc:date>2017-03-28T20:44:39Z</dc:date>
    </item>
    <item>
      <title>Re: REX Non-Capture Group</title>
      <link>https://community.splunk.com/t5/Splunk-Search/REX-Non-Capture-Group/m-p/303661#M91346</link>
      <description>&lt;P&gt;The main reason to have a non-capture group is because you need to do something to that thing as a group of text but not put it into a field.  For example, in a CSV, to grab the 30th thing, you might use this:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;| rex "^(?:[^,]*,){29}(?&amp;lt;csv30&amp;gt;[^,]*)"
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;So because I needed to skip 29 of the same thing, I put that thing (a CSV field plus the delimiting comma) into a (non-capturing) group and applied the multiplier &lt;CODE&gt;{29}&lt;/CODE&gt;.  Then I capture the next thing and name it.&lt;/P&gt;

&lt;P&gt;So is your question truly academic or are you trying to do something with some data?  If you are trying to do something, then show us the sample event data and describe what fields that you would like to create and we can help some more.&lt;/P&gt;</description>
      <pubDate>Tue, 28 Mar 2017 22:58:44 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/REX-Non-Capture-Group/m-p/303661#M91346</guid>
      <dc:creator>woodcock</dc:creator>
      <dc:date>2017-03-28T22:58:44Z</dc:date>
    </item>
  </channel>
</rss>

