<?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: Rex to select number from string in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/Rex-to-select-number-from-string/m-p/321461#M96037</link>
    <description>&lt;P&gt;thank you! worked perfectly!&lt;/P&gt;</description>
    <pubDate>Wed, 07 Mar 2018 13:45:52 GMT</pubDate>
    <dc:creator>abbam</dc:creator>
    <dc:date>2018-03-07T13:45:52Z</dc:date>
    <item>
      <title>Rex to select number from string</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Rex-to-select-number-from-string/m-p/321456#M96032</link>
      <description>&lt;P&gt;Hi All,&lt;/P&gt;

&lt;P&gt;I am trying to select numbers from a field using Rex, but I cannot seem to figure it out.&lt;/P&gt;

&lt;P&gt;Basically the values that i have in the field are:&lt;/P&gt;

&lt;P&gt;XX (432)&lt;BR /&gt;
FH02 (2356)&lt;BR /&gt;
YR01 (855553)&lt;/P&gt;

&lt;P&gt;I want to be able to select the number in the () - this number can be of any length.&lt;/P&gt;

&lt;P&gt;How can I do this?&lt;/P&gt;

&lt;P&gt;Thanks!&lt;/P&gt;</description>
      <pubDate>Wed, 07 Mar 2018 12:58:15 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Rex-to-select-number-from-string/m-p/321456#M96032</guid>
      <dc:creator>abbam</dc:creator>
      <dc:date>2018-03-07T12:58:15Z</dc:date>
    </item>
    <item>
      <title>Re: Rex to select number from string</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Rex-to-select-number-from-string/m-p/321457#M96033</link>
      <description>&lt;P&gt;Hi @abbam,&lt;BR /&gt;
try this:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;|rex field=&amp;lt;fieldname&amp;gt; "\((?&amp;lt;number&amp;gt;\d+)"
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;try this run anywhere search:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;|makeresults|eval sample="XX (432)"|rex field=sample "\((?&amp;lt;number&amp;gt;\d+)"
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Wed, 07 Mar 2018 13:04:05 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Rex-to-select-number-from-string/m-p/321457#M96033</guid>
      <dc:creator>493669</dc:creator>
      <dc:date>2018-03-07T13:04:05Z</dc:date>
    </item>
    <item>
      <title>Re: Rex to select number from string</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Rex-to-select-number-from-string/m-p/321458#M96034</link>
      <description>&lt;P&gt;You can try something like this&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;&amp;lt;your base search&amp;gt; | rex field=&amp;lt;fieldname&amp;gt; "\s\((?&amp;lt;number&amp;gt;[^\)]+)"
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;let me know if this helps!&lt;/P&gt;</description>
      <pubDate>Wed, 07 Mar 2018 13:25:50 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Rex-to-select-number-from-string/m-p/321458#M96034</guid>
      <dc:creator>mayurr98</dc:creator>
      <dc:date>2018-03-07T13:25:50Z</dc:date>
    </item>
    <item>
      <title>Re: Rex to select number from string</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Rex-to-select-number-from-string/m-p/321459#M96035</link>
      <description>&lt;P&gt;Thank you!&lt;/P&gt;

&lt;P&gt;How would you do it if the field was multivalue?&lt;/P&gt;</description>
      <pubDate>Wed, 07 Mar 2018 13:31:55 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Rex-to-select-number-from-string/m-p/321459#M96035</guid>
      <dc:creator>abbam</dc:creator>
      <dc:date>2018-03-07T13:31:55Z</dc:date>
    </item>
    <item>
      <title>Re: Rex to select number from string</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Rex-to-select-number-from-string/m-p/321460#M96036</link>
      <description>&lt;P&gt;try this if the field is multivalue&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;| rex field=&amp;lt;fieldname&amp;gt; max_match=0 "\s\((?&amp;lt;number&amp;gt;[^\)]+)"
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Wed, 07 Mar 2018 13:37:43 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Rex-to-select-number-from-string/m-p/321460#M96036</guid>
      <dc:creator>mayurr98</dc:creator>
      <dc:date>2018-03-07T13:37:43Z</dc:date>
    </item>
    <item>
      <title>Re: Rex to select number from string</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Rex-to-select-number-from-string/m-p/321461#M96037</link>
      <description>&lt;P&gt;thank you! worked perfectly!&lt;/P&gt;</description>
      <pubDate>Wed, 07 Mar 2018 13:45:52 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Rex-to-select-number-from-string/m-p/321461#M96037</guid>
      <dc:creator>abbam</dc:creator>
      <dc:date>2018-03-07T13:45:52Z</dc:date>
    </item>
  </channel>
</rss>

