<?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 extract substring in a string for eval case? in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/How-to-extract-substring-in-a-string-for-eval-case/m-p/335408#M99637</link>
    <description>&lt;P&gt;hello there,&lt;BR /&gt;
try this:&lt;BR /&gt;
&lt;CODE&gt;... your search ... | rex field=CATEGORY3 "Bundle With (?P&amp;lt;num_of_inc&amp;gt;\d+) INC"&lt;/CODE&gt;&lt;BR /&gt;
hope it helps&lt;/P&gt;</description>
    <pubDate>Fri, 13 Apr 2018 13:53:17 GMT</pubDate>
    <dc:creator>adonio</dc:creator>
    <dc:date>2018-04-13T13:53:17Z</dc:date>
    <item>
      <title>How to extract substring in a string for eval case?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-extract-substring-in-a-string-for-eval-case/m-p/335405#M99634</link>
      <description>&lt;P&gt;Hi All,&lt;/P&gt;

&lt;P&gt;I have a field "CATEGORY3," with strings for example:- &lt;BR /&gt;
Log 1.2 Bundle With 12 INC&lt;BR /&gt;&lt;BR /&gt;
Log 1.2 Bundle With 3 INC &lt;BR /&gt;
Log 1.2 Bundle With 103 INC&lt;BR /&gt;
Log 1.3 IP&lt;BR /&gt;
Log 1.3 IP&lt;/P&gt;

&lt;P&gt;I just need to extract the number of INCs if the CATEGORY3  contains Bundle Keyword. I tried something like substr(CATEGORY3,19,3),   but it won't give a proper answer.&lt;BR /&gt;
I was trying to look for regex as well, but I really do not know how to rex command inside eval case &lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;index="index1" sourcetype="XXX" | eval NE_COUNT= case(match(CREATOR_SUBJECT,"Bundle"),  , match(CREATOR_SUBJECT,"IP"), 1 )
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Thanks in advance&lt;/P&gt;</description>
      <pubDate>Fri, 13 Apr 2018 11:08:45 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-extract-substring-in-a-string-for-eval-case/m-p/335405#M99634</guid>
      <dc:creator>Chandras11</dc:creator>
      <dc:date>2018-04-13T11:08:45Z</dc:date>
    </item>
    <item>
      <title>Re: How to extract substring in a string for eval case?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-extract-substring-in-a-string-for-eval-case/m-p/335406#M99635</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;

&lt;P&gt;Can you try below rex which only works on event which has Bundle keyword:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;| rex field=_raw "Bundle With (?P&amp;lt;inc_count&amp;gt;\d+) INC"
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Fri, 13 Apr 2018 12:27:59 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-extract-substring-in-a-string-for-eval-case/m-p/335406#M99635</guid>
      <dc:creator>p_gurav</dc:creator>
      <dc:date>2018-04-13T12:27:59Z</dc:date>
    </item>
    <item>
      <title>Re: How to extract substring in a string for eval case?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-extract-substring-in-a-string-for-eval-case/m-p/335407#M99636</link>
      <description>&lt;P&gt;Hey @p_gurav - I think your code is getting mangled because you forgot to use the &lt;CODE&gt;010101&lt;/CODE&gt; code button. Maybe fix it so the user can test? I think your answer is probably correct!&lt;/P&gt;</description>
      <pubDate>Fri, 13 Apr 2018 12:56:57 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-extract-substring-in-a-string-for-eval-case/m-p/335407#M99636</guid>
      <dc:creator>elliotproebstel</dc:creator>
      <dc:date>2018-04-13T12:56:57Z</dc:date>
    </item>
    <item>
      <title>Re: How to extract substring in a string for eval case?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-extract-substring-in-a-string-for-eval-case/m-p/335408#M99637</link>
      <description>&lt;P&gt;hello there,&lt;BR /&gt;
try this:&lt;BR /&gt;
&lt;CODE&gt;... your search ... | rex field=CATEGORY3 "Bundle With (?P&amp;lt;num_of_inc&amp;gt;\d+) INC"&lt;/CODE&gt;&lt;BR /&gt;
hope it helps&lt;/P&gt;</description>
      <pubDate>Fri, 13 Apr 2018 13:53:17 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-extract-substring-in-a-string-for-eval-case/m-p/335408#M99637</guid>
      <dc:creator>adonio</dc:creator>
      <dc:date>2018-04-13T13:53:17Z</dc:date>
    </item>
    <item>
      <title>Re: How to extract substring in a string for eval case?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-extract-substring-in-a-string-for-eval-case/m-p/335409#M99638</link>
      <description>&lt;P&gt;Thanks for the Answer. Its working and I learn a new point here. Just want to point that instead of checking in _raw , we can also use the field name CATEGORY3 for faster exeution. &lt;/P&gt;</description>
      <pubDate>Fri, 13 Apr 2018 14:29:40 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-extract-substring-in-a-string-for-eval-case/m-p/335409#M99638</guid>
      <dc:creator>Chandras11</dc:creator>
      <dc:date>2018-04-13T14:29:40Z</dc:date>
    </item>
    <item>
      <title>Re: How to extract substring in a string for eval case?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-extract-substring-in-a-string-for-eval-case/m-p/335410#M99639</link>
      <description>&lt;P&gt;for followers, in general you extract using substr in an "eval" see &lt;A href="https://answers.splunk.com/answers/210683/how-to-use-substr-to-extract-the-first-3-letters-o.html"&gt;https://answers.splunk.com/answers/210683/how-to-use-substr-to-extract-the-first-3-letters-o.html&lt;/A&gt;&lt;/P&gt;</description>
      <pubDate>Fri, 22 Nov 2019 21:05:52 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-extract-substring-in-a-string-for-eval-case/m-p/335410#M99639</guid>
      <dc:creator>rogerdpack</dc:creator>
      <dc:date>2019-11-22T21:05:52Z</dc:date>
    </item>
  </channel>
</rss>

