<?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: Extract Value in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/Extract-Value/m-p/193620#M55769</link>
    <description>&lt;P&gt;Thanks &lt;/P&gt;

&lt;P&gt;the point is "XYZ Inc","Air","0 Days + 01:00:00",1,"0.000 %"&lt;BR /&gt;
is just one example of event i have various other events with different text, in that case i dont think hard coding the values in seacrh will work?&lt;/P&gt;</description>
    <pubDate>Wed, 19 Mar 2014 16:08:53 GMT</pubDate>
    <dc:creator>nikhilmehra79</dc:creator>
    <dc:date>2014-03-19T16:08:53Z</dc:date>
    <item>
      <title>Extract Value</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Extract-Value/m-p/193613#M55762</link>
      <description>&lt;P&gt;I have a search result with following string i just need to extract the value - 0.000 (just before %) from this string below &lt;/P&gt;

&lt;P&gt;"XYZ Inc","Air","0 Days + 01:00:00",1,"0.000 %"&lt;/P&gt;

&lt;P&gt;I tried following &lt;/P&gt;

&lt;P&gt;..| rex field=_raw "(?&lt;NAME&gt;.&lt;EM&gt;),(?&lt;TYPE&gt;.&lt;/TYPE&gt;&lt;/EM&gt;),(?&lt;DTIME&gt;.&lt;EM&gt;),(?&lt;NUMBER_OF_OUT&gt;.&lt;/NUMBER_OF_OUT&gt;&lt;/EM&gt;),(?&lt;AVAIL&gt;.*)" | search Avail != null | table Avail  but looks like i need to get more regex&lt;/AVAIL&gt;&lt;/DTIME&gt;&lt;/NAME&gt;&lt;/P&gt;</description>
      <pubDate>Mon, 28 Sep 2020 16:10:16 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Extract-Value/m-p/193613#M55762</guid>
      <dc:creator>nikhilmehra79</dc:creator>
      <dc:date>2020-09-28T16:10:16Z</dc:date>
    </item>
    <item>
      <title>Re: Extract Value</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Extract-Value/m-p/193614#M55763</link>
      <description>&lt;P&gt;Close... you're missing a few details.&lt;/P&gt;

&lt;P&gt;Here is your regex (the double quotes are escaped only when you use them in the search box, because the rex command wants the regex contained in double quotes... it isn't regex that requires them escaped, mind you)&lt;/P&gt;

&lt;P&gt;&lt;CODE&gt;your base search | rex field=_raw"^\"(?P&amp;lt;name&amp;gt;.+)\",\"(?P&amp;lt;Type&amp;gt;.+)\",\"(?P&amp;lt;tdtime&amp;gt;.+)\",(?P&amp;lt;number_of_out&amp;gt;\d+),\"(?P&amp;lt;avail&amp;gt;.+)%\""&lt;/CODE&gt;&lt;/P&gt;

&lt;P&gt;This site is very helpful for testing:&lt;/P&gt;

&lt;P&gt;&lt;A href="http://www.regexr.com/"&gt;http://www.regexr.com/&lt;/A&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 19 Mar 2014 01:07:58 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Extract-Value/m-p/193614#M55763</guid>
      <dc:creator>rsennett_splunk</dc:creator>
      <dc:date>2014-03-19T01:07:58Z</dc:date>
    </item>
    <item>
      <title>Re: Extract Value</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Extract-Value/m-p/193615#M55764</link>
      <description>&lt;P&gt;its says error&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;Error in 'rex' command: Invalid argument: '"(?&amp;lt;Type&amp;gt;.*)"'
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Wed, 19 Mar 2014 05:30:53 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Extract-Value/m-p/193615#M55764</guid>
      <dc:creator>nikhilmehra79</dc:creator>
      <dc:date>2014-03-19T05:30:53Z</dc:date>
    </item>
    <item>
      <title>Re: Extract Value</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Extract-Value/m-p/193616#M55765</link>
      <description>&lt;P&gt;You may want to just use the field extractor and avoid using the rex command altogether...&lt;/P&gt;</description>
      <pubDate>Wed, 19 Mar 2014 06:22:34 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Extract-Value/m-p/193616#M55765</guid>
      <dc:creator>rsennett_splunk</dc:creator>
      <dc:date>2014-03-19T06:22:34Z</dc:date>
    </item>
    <item>
      <title>Re: Extract Value</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Extract-Value/m-p/193617#M55766</link>
      <description>&lt;P&gt;you have a example and is it not possible to use regex to do the same?&lt;/P&gt;</description>
      <pubDate>Wed, 19 Mar 2014 06:45:29 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Extract-Value/m-p/193617#M55766</guid>
      <dc:creator>nikhilmehra79</dc:creator>
      <dc:date>2014-03-19T06:45:29Z</dc:date>
    </item>
    <item>
      <title>Re: Extract Value</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Extract-Value/m-p/193618#M55767</link>
      <description>&lt;P&gt;above regex works for me&lt;/P&gt;

&lt;UL&gt;
&lt;LI&gt;| head 1 | eval _raw="\"XYZ Inc\",\"Air\",\"0 Days + 01:00:00\",1,\"0.000 %\"" | table _raw | rex field=_raw "^\"(?P&lt;NAME&gt;.+)\",\"(?P&lt;TYPE&gt;.+)\",\"(?P&lt;TDTIME&gt;.+)\",(?P&lt;NUMBER_OF_OUT&gt;\d+),\"(?P&lt;AVAIL&gt;.+)%\""&lt;/AVAIL&gt;&lt;/NUMBER_OF_OUT&gt;&lt;/TDTIME&gt;&lt;/TYPE&gt;&lt;/NAME&gt;&lt;/LI&gt;
&lt;/UL&gt;</description>
      <pubDate>Mon, 28 Sep 2020 16:10:47 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Extract-Value/m-p/193618#M55767</guid>
      <dc:creator>somesoni2</dc:creator>
      <dc:date>2020-09-28T16:10:47Z</dc:date>
    </item>
    <item>
      <title>Re: Extract Value</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Extract-Value/m-p/193619#M55768</link>
      <description>&lt;P&gt;nikhilmehra79,  you should copy EXACTLY what somesoni2 has given you and try that. Do not change the regex. It is the same as the one I gave you exactly... and it works. The difference is - this version has kindly given you the entire search. I was lazy. &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;BR /&gt;
I have edited the answer accordingly - including the prefix eval so that the code is independent for those of us who do not have your data in an index.&lt;/P&gt;</description>
      <pubDate>Wed, 19 Mar 2014 14:57:25 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Extract-Value/m-p/193619#M55768</guid>
      <dc:creator>rsennett_splunk</dc:creator>
      <dc:date>2014-03-19T14:57:25Z</dc:date>
    </item>
    <item>
      <title>Re: Extract Value</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Extract-Value/m-p/193620#M55769</link>
      <description>&lt;P&gt;Thanks &lt;/P&gt;

&lt;P&gt;the point is "XYZ Inc","Air","0 Days + 01:00:00",1,"0.000 %"&lt;BR /&gt;
is just one example of event i have various other events with different text, in that case i dont think hard coding the values in seacrh will work?&lt;/P&gt;</description>
      <pubDate>Wed, 19 Mar 2014 16:08:53 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Extract-Value/m-p/193620#M55769</guid>
      <dc:creator>nikhilmehra79</dc:creator>
      <dc:date>2014-03-19T16:08:53Z</dc:date>
    </item>
    <item>
      <title>Re: Extract Value</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Extract-Value/m-p/193621#M55770</link>
      <description>&lt;P&gt;remove the hard-coding part and use your own search parameter. This was just the example.&lt;/P&gt;</description>
      <pubDate>Wed, 19 Mar 2014 17:31:29 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Extract-Value/m-p/193621#M55770</guid>
      <dc:creator>somesoni2</dc:creator>
      <dc:date>2014-03-19T17:31:29Z</dc:date>
    </item>
    <item>
      <title>Re: Extract Value</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Extract-Value/m-p/193622#M55771</link>
      <description>&lt;P&gt;Thanks worked.&lt;/P&gt;</description>
      <pubDate>Wed, 19 Mar 2014 22:31:51 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Extract-Value/m-p/193622#M55771</guid>
      <dc:creator>nikhilmehra79</dc:creator>
      <dc:date>2014-03-19T22:31:51Z</dc:date>
    </item>
    <item>
      <title>Re: Extract Value</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Extract-Value/m-p/193623#M55772</link>
      <description>&lt;P&gt;Great! Glad we could help.&lt;/P&gt;</description>
      <pubDate>Wed, 19 Mar 2014 22:45:14 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Extract-Value/m-p/193623#M55772</guid>
      <dc:creator>rsennett_splunk</dc:creator>
      <dc:date>2014-03-19T22:45:14Z</dc:date>
    </item>
  </channel>
</rss>

