<?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 use Regex on non-uniform data in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/How-to-use-Regex-on-non-uniform-data/m-p/585955#M204119</link>
    <description>&lt;P&gt;I'm trying to extract a number that may not always be formatted the same way every time.&lt;/P&gt;
&lt;P&gt;Examples:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;OK: Process matching httpd is using 0% CPU&lt;/LI-CODE&gt;&lt;LI-CODE lang="markup"&gt;OK: Process matching httpd is using 1.1% CPU&lt;/LI-CODE&gt;&lt;LI-CODE lang="markup"&gt;OK: Process matching httpd is using 24.1% CPU&lt;/LI-CODE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;It's the "0%" that is tripping me up.&lt;/P&gt;
&lt;P&gt;This will work for numbers with a decimal but not for a percentage that is just "0".&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;rex "using\s(?&amp;lt;CPU_util_perc&amp;gt;\d+.\d+)\%"&lt;/LI-CODE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Any help is greatly appreciated.&lt;/P&gt;</description>
    <pubDate>Tue, 22 Feb 2022 16:57:06 GMT</pubDate>
    <dc:creator>paulito</dc:creator>
    <dc:date>2022-02-22T16:57:06Z</dc:date>
    <item>
      <title>How to use Regex on non-uniform data</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-use-Regex-on-non-uniform-data/m-p/585955#M204119</link>
      <description>&lt;P&gt;I'm trying to extract a number that may not always be formatted the same way every time.&lt;/P&gt;
&lt;P&gt;Examples:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;OK: Process matching httpd is using 0% CPU&lt;/LI-CODE&gt;&lt;LI-CODE lang="markup"&gt;OK: Process matching httpd is using 1.1% CPU&lt;/LI-CODE&gt;&lt;LI-CODE lang="markup"&gt;OK: Process matching httpd is using 24.1% CPU&lt;/LI-CODE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;It's the "0%" that is tripping me up.&lt;/P&gt;
&lt;P&gt;This will work for numbers with a decimal but not for a percentage that is just "0".&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;rex "using\s(?&amp;lt;CPU_util_perc&amp;gt;\d+.\d+)\%"&lt;/LI-CODE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Any help is greatly appreciated.&lt;/P&gt;</description>
      <pubDate>Tue, 22 Feb 2022 16:57:06 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-use-Regex-on-non-uniform-data/m-p/585955#M204119</guid>
      <dc:creator>paulito</dc:creator>
      <dc:date>2022-02-22T16:57:06Z</dc:date>
    </item>
    <item>
      <title>Re: Regex on non-uniform data</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-use-Regex-on-non-uniform-data/m-p/585956#M204120</link>
      <description>&lt;P&gt;Try this regex.&amp;nbsp; It accepts any combination of digits and decimals.&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;using\s(?&amp;lt;CPU_util_perc&amp;gt;[\d\.]+)\%&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;You also could use&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;using\s(?&amp;lt;CPU_util_perc&amp;gt;.+)\%&lt;/LI-CODE&gt;&lt;P&gt;since there's (probably) little chance of anything other than a number being in that position.&lt;/P&gt;</description>
      <pubDate>Mon, 21 Feb 2022 19:16:20 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-use-Regex-on-non-uniform-data/m-p/585956#M204120</guid>
      <dc:creator>richgalloway</dc:creator>
      <dc:date>2022-02-21T19:16:20Z</dc:date>
    </item>
    <item>
      <title>Re: Regex on non-uniform data</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-use-Regex-on-non-uniform-data/m-p/585957#M204121</link>
      <description>&lt;P&gt;This worked on the sample data you provided.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;using\s(?&amp;lt;CPU_util_perc&amp;gt;[0-9\.]{1,4})%&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 21 Feb 2022 19:37:02 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-use-Regex-on-non-uniform-data/m-p/585957#M204121</guid>
      <dc:creator>crv3347</dc:creator>
      <dc:date>2022-02-21T19:37:02Z</dc:date>
    </item>
    <item>
      <title>Re: Regex on non-uniform data</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-use-Regex-on-non-uniform-data/m-p/585958#M204122</link>
      <description>&lt;P&gt;Give this a try&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;| rex "using\s(?&amp;lt;CPU_util_perc&amp;gt;\d+(\.\d+)*)\%"
OR
| rex "using\s(?&amp;lt;CPU_util_perc&amp;gt;[^\%]+)\%"&lt;/LI-CODE&gt;</description>
      <pubDate>Mon, 21 Feb 2022 19:37:34 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-use-Regex-on-non-uniform-data/m-p/585958#M204122</guid>
      <dc:creator>somesoni2</dc:creator>
      <dc:date>2022-02-21T19:37:34Z</dc:date>
    </item>
    <item>
      <title>Re: Regex on non-uniform data</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-use-Regex-on-non-uniform-data/m-p/585959#M204123</link>
      <description>&lt;P&gt;They both work!&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thank you&lt;/P&gt;</description>
      <pubDate>Mon, 21 Feb 2022 19:40:04 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-use-Regex-on-non-uniform-data/m-p/585959#M204123</guid>
      <dc:creator>paulito</dc:creator>
      <dc:date>2022-02-21T19:40:04Z</dc:date>
    </item>
    <item>
      <title>Re: Regex on non-uniform data</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-use-Regex-on-non-uniform-data/m-p/585961#M204125</link>
      <description>&lt;P&gt;If your problem is resolved, then please click one of the "Accept as Solution" buttons to help future readers.&lt;/P&gt;</description>
      <pubDate>Mon, 21 Feb 2022 19:45:33 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-use-Regex-on-non-uniform-data/m-p/585961#M204125</guid>
      <dc:creator>richgalloway</dc:creator>
      <dc:date>2022-02-21T19:45:33Z</dc:date>
    </item>
  </channel>
</rss>

