<?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: Extracting numbers between words in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/Extracting-numbers-between-words/m-p/257454#M77121</link>
    <description>&lt;P&gt;Thank you so much, especially with the regex101.com. The steps you gave equally helped.&lt;/P&gt;</description>
    <pubDate>Wed, 23 Mar 2016 12:53:08 GMT</pubDate>
    <dc:creator>ibekacyril</dc:creator>
    <dc:date>2016-03-23T12:53:08Z</dc:date>
    <item>
      <title>Extracting numbers between words</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Extracting-numbers-between-words/m-p/257452#M77119</link>
      <description>&lt;P&gt;Say I have this data:&lt;/P&gt;

&lt;P&gt;c.i.m This is just a sample 23456 Yes it is true.&lt;/P&gt;

&lt;P&gt;My question is how do I extract 23456 and pass it to a new field since there is no key-value pair in this scenario? I would also want to do a count on the new field. &lt;/P&gt;

&lt;P&gt;Thanks and please I would not mind some explanation on your code too.&lt;/P&gt;</description>
      <pubDate>Wed, 23 Mar 2016 05:04:37 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Extracting-numbers-between-words/m-p/257452#M77119</guid>
      <dc:creator>ibekacyril</dc:creator>
      <dc:date>2016-03-23T05:04:37Z</dc:date>
    </item>
    <item>
      <title>Re: Extracting numbers between words</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Extracting-numbers-between-words/m-p/257453#M77120</link>
      <description>&lt;P&gt;Hi ibekacyril,&lt;/P&gt;

&lt;P&gt;Well, the straight approach is to get only &lt;CODE&gt;digits&lt;/CODE&gt; matching in the regex&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;(?&amp;lt;my_number&amp;gt;\d+)
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;This will create a field called &lt;CODE&gt;my_number&lt;/CODE&gt; and you can run a &lt;CODE&gt;stats count(my_number)&lt;/CODE&gt; on it &lt;span class="lia-unicode-emoji" title=":winking_face:"&gt;😉&lt;/span&gt;&lt;/P&gt;

&lt;P&gt;Next example is this one:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;\w+\s(?&amp;lt;my_number&amp;gt;[^\s]+)\s
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;That's faster but will match &lt;CODE&gt;This&lt;/CODE&gt; and you want the numbers ... so on to the next one&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;(?:\w\s)+(?&amp;lt;my_number&amp;gt;\d+)\s
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;a non-captureing group of &lt;CODE&gt;one and unlimited times, as many times as possible, giving back as needed [greedy]&lt;BR /&gt;
\w match any word character [a-zA-Z0-9_] \s match any white space character [\r\n\t\f ]&lt;/CODE&gt; but this will be slower because it will need more steps to match the result you want - Hint: &lt;A href="http://www.regex101.com"&gt;www.regex101.com&lt;/A&gt;&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;c\.i\.m\sThis\sis\sjust\sa\ssample\s(?&amp;lt;my_number&amp;gt;\d+)\s
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;almost as fast as the first one, but it take a bit more steps to match&lt;/P&gt;

&lt;P&gt;There almost endless possibilities for regex to match, but you want the most efficient one - use regex101.com and learn how to use regex &lt;span class="lia-unicode-emoji" title=":winking_face:"&gt;😉&lt;/span&gt;&lt;/P&gt;

&lt;P&gt;Hope this helps ...&lt;/P&gt;

&lt;P&gt;cheers, MuS&lt;/P&gt;</description>
      <pubDate>Wed, 23 Mar 2016 06:56:21 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Extracting-numbers-between-words/m-p/257453#M77120</guid>
      <dc:creator>MuS</dc:creator>
      <dc:date>2016-03-23T06:56:21Z</dc:date>
    </item>
    <item>
      <title>Re: Extracting numbers between words</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Extracting-numbers-between-words/m-p/257454#M77121</link>
      <description>&lt;P&gt;Thank you so much, especially with the regex101.com. The steps you gave equally helped.&lt;/P&gt;</description>
      <pubDate>Wed, 23 Mar 2016 12:53:08 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Extracting-numbers-between-words/m-p/257454#M77121</guid>
      <dc:creator>ibekacyril</dc:creator>
      <dc:date>2016-03-23T12:53:08Z</dc:date>
    </item>
  </channel>
</rss>

