<?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: use regex to remove a number from a string in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/use-regex-to-remove-a-number-from-a-string/m-p/347156#M102778</link>
    <description>&lt;P&gt;This produces this message:&lt;/P&gt;

&lt;P&gt;"Error in 'rex' command: Encountered the following error while compiling the regex '^(?P[^.]+)': Regex: unrecognized character after (?P"&lt;/P&gt;</description>
    <pubDate>Fri, 25 Jan 2019 15:55:16 GMT</pubDate>
    <dc:creator>ryhluc01</dc:creator>
    <dc:date>2019-01-25T15:55:16Z</dc:date>
    <item>
      <title>use regex to remove a number from a string</title>
      <link>https://community.splunk.com/t5/Splunk-Search/use-regex-to-remove-a-number-from-a-string/m-p/347153#M102775</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;

&lt;P&gt;I want to remove a number (up to 5 digits) from a string on its beginning.&lt;BR /&gt;
an example:&lt;/P&gt;

&lt;P&gt;43.aaaa_vvvvv.cccccc:dddddd          =&amp;gt; aaaa_vvvvv.cccccc:dddddd&lt;BR /&gt;
9374.aaaa_vvvvv.cccccc:dddddd      =&amp;gt; aaaa_vvvvv.cccccc:dddddd&lt;BR /&gt;
1.aaaa_vvvvv.cccccc:dddddd            =&amp;gt;  aaaa_vvvvv.cccccc:dddddd&lt;/P&gt;

&lt;P&gt;I only need to remove the first number and the "." after it.&lt;/P&gt;

&lt;P&gt;thanks&lt;/P&gt;</description>
      <pubDate>Tue, 29 Sep 2020 17:18:08 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/use-regex-to-remove-a-number-from-a-string/m-p/347153#M102775</guid>
      <dc:creator>matansocher</dc:creator>
      <dc:date>2020-09-29T17:18:08Z</dc:date>
    </item>
    <item>
      <title>Re: use regex to remove a number from a string</title>
      <link>https://community.splunk.com/t5/Splunk-Search/use-regex-to-remove-a-number-from-a-string/m-p/347154#M102776</link>
      <description>&lt;P&gt;@matansocher, is this a field or raw data?&lt;BR /&gt;
You can try the following &lt;CODE&gt;rex&lt;/CODE&gt; command:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;&amp;lt;your base search&amp;gt;
| rex field=_raw "\d+.(?&amp;lt;myData&amp;gt;.*)"
| table _raw myData
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;I have use field name as _raw but you can replace with your own if it is some other field. Alternatively you can also use &lt;CODE&gt;replace()&lt;/CODE&gt; command with regular expression if this is a field.&lt;/P&gt;</description>
      <pubDate>Mon, 18 Dec 2017 07:14:09 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/use-regex-to-remove-a-number-from-a-string/m-p/347154#M102776</guid>
      <dc:creator>niketn</dc:creator>
      <dc:date>2017-12-18T07:14:09Z</dc:date>
    </item>
    <item>
      <title>Re: use regex to remove a number from a string</title>
      <link>https://community.splunk.com/t5/Splunk-Search/use-regex-to-remove-a-number-from-a-string/m-p/347155#M102777</link>
      <description>&lt;P&gt;Hi matansocher,&lt;BR /&gt;
Try the regex below. Let me know if this works.&lt;BR /&gt;
index=xyz| rex field=_raw "^(?P[^.]+)"&lt;/P&gt;</description>
      <pubDate>Mon, 18 Dec 2017 07:14:54 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/use-regex-to-remove-a-number-from-a-string/m-p/347155#M102777</guid>
      <dc:creator>nikita_p</dc:creator>
      <dc:date>2017-12-18T07:14:54Z</dc:date>
    </item>
    <item>
      <title>Re: use regex to remove a number from a string</title>
      <link>https://community.splunk.com/t5/Splunk-Search/use-regex-to-remove-a-number-from-a-string/m-p/347156#M102778</link>
      <description>&lt;P&gt;This produces this message:&lt;/P&gt;

&lt;P&gt;"Error in 'rex' command: Encountered the following error while compiling the regex '^(?P[^.]+)': Regex: unrecognized character after (?P"&lt;/P&gt;</description>
      <pubDate>Fri, 25 Jan 2019 15:55:16 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/use-regex-to-remove-a-number-from-a-string/m-p/347156#M102778</guid>
      <dc:creator>ryhluc01</dc:creator>
      <dc:date>2019-01-25T15:55:16Z</dc:date>
    </item>
  </channel>
</rss>

