<?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 edit my regular expression to extract the numbers and semicolons from my sample data? in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/How-to-edit-my-regular-expression-to-extract-the-numbers-and/m-p/272171#M81896</link>
    <description>&lt;P&gt;Here's another way.  Still couldn't get it in just one rex.&lt;/P&gt;

&lt;P&gt;This generates test results -&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;| makeresults | eval testfield="{\"timehours\":\"16\",\"timeminutes\":\"34\",\"timeseconds\":\"11\"}" 
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;This pulls out the time parts -&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;| rex field=testfield max_match=3 "(?&amp;lt;mytime&amp;gt;\d{1,2})" | eval mytime=mvjoin(mytime,":")
&lt;/CODE&gt;&lt;/PRE&gt;</description>
    <pubDate>Wed, 01 Feb 2017 19:32:35 GMT</pubDate>
    <dc:creator>DalJeanis</dc:creator>
    <dc:date>2017-02-01T19:32:35Z</dc:date>
    <item>
      <title>How to edit my regular expression to extract the numbers and semicolons from my sample data?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-edit-my-regular-expression-to-extract-the-numbers-and/m-p/272167#M81892</link>
      <description>&lt;P&gt;I don't understand how Splunk does regex!&lt;BR /&gt;
I have this search below:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;...
| spath output=test path=a.b.c
| rex field=test "?&amp;lt;test1&amp;gt;[0-9]+"
| table test, test1
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Test is this: &lt;CODE&gt;{"timehours":"16","timeminutes":"34","timeseconds":"11"}&lt;/CODE&gt;&lt;/P&gt;

&lt;P&gt;How do I extract just the numbers and semicolon except the first semicolon?&lt;BR /&gt;
Thanks!&lt;/P&gt;</description>
      <pubDate>Tue, 25 Oct 2016 16:39:35 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-edit-my-regular-expression-to-extract-the-numbers-and/m-p/272167#M81892</guid>
      <dc:creator>ayusuf</dc:creator>
      <dc:date>2016-10-25T16:39:35Z</dc:date>
    </item>
    <item>
      <title>Re: How to edit my regular expression to extract the numbers and semicolons from my sample data?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-edit-my-regular-expression-to-extract-the-numbers-and/m-p/272168#M81893</link>
      <description>&lt;P&gt;Try this&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt; ...
 | spath output=test path=a.b.c
 | rex max_match=3 field=test "(?&amp;lt;t&amp;gt;\d{1,2})"
 | eval test1=mvindex(t, 0).":".mvindex(t, 1).":".mvindex(t, -1)
 | table test, test1
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Tue, 25 Oct 2016 17:29:45 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-edit-my-regular-expression-to-extract-the-numbers-and/m-p/272168#M81893</guid>
      <dc:creator>sundareshr</dc:creator>
      <dc:date>2016-10-25T17:29:45Z</dc:date>
    </item>
    <item>
      <title>Re: How to edit my regular expression to extract the numbers and semicolons from my sample data?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-edit-my-regular-expression-to-extract-the-numbers-and/m-p/272169#M81894</link>
      <description>&lt;P&gt;That works but is there a way to do it all in rex? Thanks.&lt;/P&gt;</description>
      <pubDate>Wed, 26 Oct 2016 13:17:27 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-edit-my-regular-expression-to-extract-the-numbers-and/m-p/272169#M81894</guid>
      <dc:creator>ayusuf</dc:creator>
      <dc:date>2016-10-26T13:17:27Z</dc:date>
    </item>
    <item>
      <title>Re: How to edit my regular expression to extract the numbers and semicolons from my sample data?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-edit-my-regular-expression-to-extract-the-numbers-and/m-p/272170#M81895</link>
      <description>&lt;P&gt;With &lt;CODE&gt;rex mode=sed&lt;/CODE&gt; you cannot assign the result to a different field. Try this&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;  ... | rex mode=sed field=test "s/{\"timehours\":\"(\d+).+?:\"(\d+).+?:\"(\d+)\"}/\1:\2:\3/g" | table test
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Wed, 26 Oct 2016 13:35:17 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-edit-my-regular-expression-to-extract-the-numbers-and/m-p/272170#M81895</guid>
      <dc:creator>sundareshr</dc:creator>
      <dc:date>2016-10-26T13:35:17Z</dc:date>
    </item>
    <item>
      <title>Re: How to edit my regular expression to extract the numbers and semicolons from my sample data?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-edit-my-regular-expression-to-extract-the-numbers-and/m-p/272171#M81896</link>
      <description>&lt;P&gt;Here's another way.  Still couldn't get it in just one rex.&lt;/P&gt;

&lt;P&gt;This generates test results -&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;| makeresults | eval testfield="{\"timehours\":\"16\",\"timeminutes\":\"34\",\"timeseconds\":\"11\"}" 
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;This pulls out the time parts -&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;| rex field=testfield max_match=3 "(?&amp;lt;mytime&amp;gt;\d{1,2})" | eval mytime=mvjoin(mytime,":")
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Wed, 01 Feb 2017 19:32:35 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-edit-my-regular-expression-to-extract-the-numbers-and/m-p/272171#M81896</guid>
      <dc:creator>DalJeanis</dc:creator>
      <dc:date>2017-02-01T19:32:35Z</dc:date>
    </item>
  </channel>
</rss>

