<?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: How to regex the field? in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/How-to-regex-the-field/m-p/450280#M127490</link>
    <description>&lt;P&gt;Hi&lt;/P&gt;

&lt;P&gt;Try this&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;| makeresults 
| eval msg="refId=Id-214f1652024d824e1f4cef63be666139\x00" 
| rex field=msg "-(?P&amp;lt;output&amp;gt;.+)\\\\"
&lt;/CODE&gt;&lt;/PRE&gt;</description>
    <pubDate>Wed, 20 Mar 2019 06:10:50 GMT</pubDate>
    <dc:creator>vnravikumar</dc:creator>
    <dc:date>2019-03-20T06:10:50Z</dc:date>
    <item>
      <title>How to regex the field?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-regex-the-field/m-p/450278#M127488</link>
      <description>&lt;P&gt;How to regex the field?&lt;/P&gt;

&lt;P&gt;refId=Id-214f1652024d824e1f4cef63be666139\x00&lt;/P&gt;

&lt;P&gt;What i used:&lt;BR /&gt;
rex field=_raw "refId=Id-(?\w*-?\w*)&lt;/P&gt;

&lt;P&gt;Expected : 214f1652024d824e1f4cef63be666139&lt;/P&gt;</description>
      <pubDate>Tue, 29 Sep 2020 23:46:17 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-regex-the-field/m-p/450278#M127488</guid>
      <dc:creator>karthi2809</dc:creator>
      <dc:date>2020-09-29T23:46:17Z</dc:date>
    </item>
    <item>
      <title>Re: How to regex the field?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-regex-the-field/m-p/450279#M127489</link>
      <description>&lt;P&gt;@karthi2809 please try the following&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;| rex "refId=Id-(?&amp;lt;refID&amp;gt;[^\\\]+)"
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Following is a sample run anywhere search to test the same in Splunk&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;| makeresults
| eval _raw="refId=Id-214f1652024d824e1f4cef63be666139\x00"
| rex "refId=Id-(?&amp;lt;refID&amp;gt;[^\\\]+)"
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Wed, 20 Mar 2019 06:07:57 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-regex-the-field/m-p/450279#M127489</guid>
      <dc:creator>niketn</dc:creator>
      <dc:date>2019-03-20T06:07:57Z</dc:date>
    </item>
    <item>
      <title>Re: How to regex the field?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-regex-the-field/m-p/450280#M127490</link>
      <description>&lt;P&gt;Hi&lt;/P&gt;

&lt;P&gt;Try this&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;| makeresults 
| eval msg="refId=Id-214f1652024d824e1f4cef63be666139\x00" 
| rex field=msg "-(?P&amp;lt;output&amp;gt;.+)\\\\"
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Wed, 20 Mar 2019 06:10:50 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-regex-the-field/m-p/450280#M127490</guid>
      <dc:creator>vnravikumar</dc:creator>
      <dc:date>2019-03-20T06:10:50Z</dc:date>
    </item>
    <item>
      <title>Re: How to regex the field?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-regex-the-field/m-p/450281#M127491</link>
      <description>&lt;P&gt;You can try this,&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;|makeresults 
|eval data="Id-214f1652024d824e1f4cef63be666139\x00"
| rex field=data "Id\-(?P&amp;lt;field_name&amp;gt;.*)\\\\"
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Wed, 20 Mar 2019 09:13:32 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-regex-the-field/m-p/450281#M127491</guid>
      <dc:creator>vinod94</dc:creator>
      <dc:date>2019-03-20T09:13:32Z</dc:date>
    </item>
    <item>
      <title>Re: How to regex the field?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-regex-the-field/m-p/450282#M127492</link>
      <description>&lt;P&gt;This is the best answer from an efficiency point of view - 13 Steps (but watch how many &lt;CODE&gt;\\&lt;/CODE&gt; you use)&lt;BR /&gt;
&lt;A href="https://regex101.com/r/IXnuzE/1"&gt;https://regex101.com/r/IXnuzE/1&lt;/A&gt;&lt;/P&gt;

&lt;P&gt;The other examples, whilst working both involve &amp;gt; 75 steps.&lt;/P&gt;</description>
      <pubDate>Wed, 20 Mar 2019 10:41:35 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-regex-the-field/m-p/450282#M127492</guid>
      <dc:creator>nickhills</dc:creator>
      <dc:date>2019-03-20T10:41:35Z</dc:date>
    </item>
    <item>
      <title>Re: How to regex the field?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-regex-the-field/m-p/450283#M127493</link>
      <description>&lt;PRE&gt;&lt;CODE&gt; | rex field=msg "\-(?P&amp;lt;output&amp;gt;[^\\\]+)" with 6 Steps
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Wed, 20 Mar 2019 11:02:36 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-regex-the-field/m-p/450283#M127493</guid>
      <dc:creator>vnravikumar</dc:creator>
      <dc:date>2019-03-20T11:02:36Z</dc:date>
    </item>
    <item>
      <title>Re: How to regex the field?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-regex-the-field/m-p/450284#M127494</link>
      <description>&lt;P&gt;Ha, that's cheating, you changed It! &lt;span class="lia-unicode-emoji" title=":grinning_face_with_smiling_eyes:"&gt;😄&lt;/span&gt;&lt;/P&gt;

&lt;P&gt;But yes, that's fewer steps, although the step count is only reduced because there are fewer characters to process.&lt;BR /&gt;&lt;BR /&gt;
The trade-off is that since you are being less specific with the preceding character match, the chances of a false positive are higher. Not an issue given the very limited example in the post, but matching preceding strings does not add any real penalty, and gives you the confidence of reducing FPs.&lt;BR /&gt;
Join the regex channel on Splunk Slack if you fancy getting down in the weeds on regex performance!&lt;BR /&gt;
There is even a weekly competition! &lt;/P&gt;</description>
      <pubDate>Wed, 20 Mar 2019 11:59:43 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-regex-the-field/m-p/450284#M127494</guid>
      <dc:creator>nickhills</dc:creator>
      <dc:date>2019-03-20T11:59:43Z</dc:date>
    </item>
    <item>
      <title>Re: How to regex the field?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-regex-the-field/m-p/450285#M127495</link>
      <description>&lt;P&gt;&lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt; I accept you.&lt;/P&gt;</description>
      <pubDate>Wed, 20 Mar 2019 12:04:26 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-regex-the-field/m-p/450285#M127495</guid>
      <dc:creator>vnravikumar</dc:creator>
      <dc:date>2019-03-20T12:04:26Z</dc:date>
    </item>
    <item>
      <title>Re: How to regex the field?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-regex-the-field/m-p/450286#M127496</link>
      <description>&lt;P&gt;@nickhillscpl, thanks I had joined.&lt;/P&gt;</description>
      <pubDate>Wed, 20 Mar 2019 12:15:29 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-regex-the-field/m-p/450286#M127496</guid>
      <dc:creator>vnravikumar</dc:creator>
      <dc:date>2019-03-20T12:15:29Z</dc:date>
    </item>
  </channel>
</rss>

