<?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: Value that may or may not be there in field extraction in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/Value-that-may-or-may-not-be-there-in-field-extraction/m-p/386036#M112683</link>
    <description>&lt;P&gt;Oh, yes, ofcourse: &lt;CODE&gt;(?&amp;lt;hrs&amp;gt;\d+)?(?: hrs?\s+)?(?&amp;lt;mins&amp;gt;\d+)?(?: mins?\s+)?(?&amp;lt;secs&amp;gt;\d+)?(?: secs?\s+)?(?&amp;lt;ms&amp;gt;\d+)?(?: ms)?&lt;/CODE&gt;&lt;BR /&gt;
&lt;A href="https://regex101.com/r/qHE6lA/3"&gt;https://regex101.com/r/qHE6lA/3&lt;/A&gt;&lt;/P&gt;</description>
    <pubDate>Fri, 12 Jul 2019 14:35:40 GMT</pubDate>
    <dc:creator>FrankVl</dc:creator>
    <dc:date>2019-07-12T14:35:40Z</dc:date>
    <item>
      <title>Value that may or may not be there in field extraction</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Value-that-may-or-may-not-be-there-in-field-extraction/m-p/386033#M112680</link>
      <description>&lt;P&gt;I am attempting to setup an exctraction for the following; 2 hrs 2 mins 36 secs 312 ms; extracting it as the time values as follows:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;(?&amp;lt;hours&amp;gt;\d+) hrs (?&amp;lt;minutes&amp;gt;\d+) mins (?&amp;lt;seconds&amp;gt;\d+) secs (?&amp;lt;milliseconds&amp;gt;\d+) ms
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;The issue is that at times we will have something line; 1 hr 2 mins 36 secs 312 ms or even just 312 ms. Can I make the extraction account for values that may or may not be there? I know with some regex's before I used a ? to say the value may or may not be there but I am not sure in the field extractor for the full value.&lt;/P&gt;</description>
      <pubDate>Fri, 12 Jul 2019 13:42:49 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Value-that-may-or-may-not-be-there-in-field-extraction/m-p/386033#M112680</guid>
      <dc:creator>aohls</dc:creator>
      <dc:date>2019-07-12T13:42:49Z</dc:date>
    </item>
    <item>
      <title>Re: Value that may or may not be there in field extraction</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Value-that-may-or-may-not-be-there-in-field-extraction/m-p/386034#M112681</link>
      <description>&lt;P&gt;Something like this: &lt;CODE&gt;EXTRACT-time = (?&amp;lt;hrs&amp;gt;\d+ hrs?)?\s*(?&amp;lt;mins&amp;gt;\d+ mins?)?\s*(?&amp;lt;secs&amp;gt;\d+ secs?)?\s*(?&amp;lt;ms&amp;gt;\d+ ms)?&lt;/CODE&gt;&lt;BR /&gt;
&lt;A href="https://regex101.com/r/qHE6lA/1"&gt;https://regex101.com/r/qHE6lA/1&lt;/A&gt;&lt;/P&gt;

&lt;P&gt;Or if you want to extract the whole things as 1 field: &lt;CODE&gt;EXTRACT-time = (?&amp;lt;time&amp;gt;(?:\d+ hrs?)?\s*(?:\d+ mins?)?\s*(?:\d+ secs?)?\s*(?:\d+ ms)?)&lt;/CODE&gt;&lt;BR /&gt;
&lt;A href="https://regex101.com/r/qHE6lA/2"&gt;https://regex101.com/r/qHE6lA/2&lt;/A&gt;&lt;/P&gt;</description>
      <pubDate>Fri, 12 Jul 2019 13:54:49 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Value-that-may-or-may-not-be-there-in-field-extraction/m-p/386034#M112681</guid>
      <dc:creator>FrankVl</dc:creator>
      <dc:date>2019-07-12T13:54:49Z</dc:date>
    </item>
    <item>
      <title>Re: Value that may or may not be there in field extraction</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Value-that-may-or-may-not-be-there-in-field-extraction/m-p/386035#M112682</link>
      <description>&lt;P&gt;The top gets close, but I do not want the hrs,mins,etc included in the extracted field. for example it is extracting "2 hrs" but I was looking to get "2".&lt;/P&gt;</description>
      <pubDate>Fri, 12 Jul 2019 14:19:30 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Value-that-may-or-may-not-be-there-in-field-extraction/m-p/386035#M112682</guid>
      <dc:creator>aohls</dc:creator>
      <dc:date>2019-07-12T14:19:30Z</dc:date>
    </item>
    <item>
      <title>Re: Value that may or may not be there in field extraction</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Value-that-may-or-may-not-be-there-in-field-extraction/m-p/386036#M112683</link>
      <description>&lt;P&gt;Oh, yes, ofcourse: &lt;CODE&gt;(?&amp;lt;hrs&amp;gt;\d+)?(?: hrs?\s+)?(?&amp;lt;mins&amp;gt;\d+)?(?: mins?\s+)?(?&amp;lt;secs&amp;gt;\d+)?(?: secs?\s+)?(?&amp;lt;ms&amp;gt;\d+)?(?: ms)?&lt;/CODE&gt;&lt;BR /&gt;
&lt;A href="https://regex101.com/r/qHE6lA/3"&gt;https://regex101.com/r/qHE6lA/3&lt;/A&gt;&lt;/P&gt;</description>
      <pubDate>Fri, 12 Jul 2019 14:35:40 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Value-that-may-or-may-not-be-there-in-field-extraction/m-p/386036#M112683</guid>
      <dc:creator>FrankVl</dc:creator>
      <dc:date>2019-07-12T14:35:40Z</dc:date>
    </item>
    <item>
      <title>Re: Value that may or may not be there in field extraction</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Value-that-may-or-may-not-be-there-in-field-extraction/m-p/386037#M112684</link>
      <description>&lt;P&gt;This worked perfect. Using (?: mins?\s+)? I assume is potentially to find the word after, so it may or may not find it due to the ? at the end correct? Just want to make sure to understand it.&lt;/P&gt;</description>
      <pubDate>Fri, 12 Jul 2019 15:00:22 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Value-that-may-or-may-not-be-there-in-field-extraction/m-p/386037#M112684</guid>
      <dc:creator>aohls</dc:creator>
      <dc:date>2019-07-12T15:00:22Z</dc:date>
    </item>
    <item>
      <title>Re: Value that may or may not be there in field extraction</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Value-that-may-or-may-not-be-there-in-field-extraction/m-p/386038#M112685</link>
      <description>&lt;P&gt;Yes, &lt;CODE&gt;?&lt;/CODE&gt; means match 0 or 1 times. So I add that behind each of the groups as well as behind the &lt;CODE&gt;s&lt;/CODE&gt; in case it shows &lt;CODE&gt;1 hr&lt;/CODE&gt; or something like that.&lt;/P&gt;</description>
      <pubDate>Sun, 14 Jul 2019 08:39:55 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Value-that-may-or-may-not-be-there-in-field-extraction/m-p/386038#M112685</guid>
      <dc:creator>FrankVl</dc:creator>
      <dc:date>2019-07-14T08:39:55Z</dc:date>
    </item>
  </channel>
</rss>

