<?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 How to grep a number from a string? in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/How-to-grep-a-number-from-a-string/m-p/214290#M62836</link>
    <description>&lt;P&gt;Hi,&lt;/P&gt;

&lt;P&gt;I have a column in my source with different severity levels, for example -&lt;/P&gt;

&lt;H2&gt;Severity&lt;/H2&gt;

&lt;P&gt;1 - High&lt;BR /&gt;
2 - Medium&lt;BR /&gt;
3 - Moderate&lt;BR /&gt;
4 - Low&lt;BR /&gt;
5 - Planning&lt;/P&gt;

&lt;P&gt;From the query I need to extract only the numbers i.e. 1, 2 etc. I have tried some answers but haven't been able to get only the number. &lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;.......| rex field=severity .severity=(?P&amp;lt;severity&amp;gt;\d+) | table severity
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;If anyone is aware kindly help. &lt;BR /&gt;
Thanks in advance. Best regards.&lt;/P&gt;</description>
    <pubDate>Fri, 04 Sep 2015 12:30:18 GMT</pubDate>
    <dc:creator>nilotpaldutta</dc:creator>
    <dc:date>2015-09-04T12:30:18Z</dc:date>
    <item>
      <title>How to grep a number from a string?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-grep-a-number-from-a-string/m-p/214290#M62836</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;

&lt;P&gt;I have a column in my source with different severity levels, for example -&lt;/P&gt;

&lt;H2&gt;Severity&lt;/H2&gt;

&lt;P&gt;1 - High&lt;BR /&gt;
2 - Medium&lt;BR /&gt;
3 - Moderate&lt;BR /&gt;
4 - Low&lt;BR /&gt;
5 - Planning&lt;/P&gt;

&lt;P&gt;From the query I need to extract only the numbers i.e. 1, 2 etc. I have tried some answers but haven't been able to get only the number. &lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;.......| rex field=severity .severity=(?P&amp;lt;severity&amp;gt;\d+) | table severity
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;If anyone is aware kindly help. &lt;BR /&gt;
Thanks in advance. Best regards.&lt;/P&gt;</description>
      <pubDate>Fri, 04 Sep 2015 12:30:18 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-grep-a-number-from-a-string/m-p/214290#M62836</guid>
      <dc:creator>nilotpaldutta</dc:creator>
      <dc:date>2015-09-04T12:30:18Z</dc:date>
    </item>
    <item>
      <title>Re: How to grep a number from a string?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-grep-a-number-from-a-string/m-p/214291#M62837</link>
      <description>&lt;P&gt;Your regex string is good.  The rex command syntax is incorrect.  Try this:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;...| rex field=severity "(?P&amp;lt;severity&amp;gt;\d+)" | table severity
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Fri, 04 Sep 2015 12:46:13 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-grep-a-number-from-a-string/m-p/214291#M62837</guid>
      <dc:creator>richgalloway</dc:creator>
      <dc:date>2015-09-04T12:46:13Z</dc:date>
    </item>
  </channel>
</rss>

