<?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 Help with regex on string with multiple number values in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/Help-with-regex-on-string-with-multiple-number-values/m-p/596629#M207689</link>
    <description>&lt;P&gt;Hi all need help getting the trailing number from a field in a search.&lt;/P&gt;
&lt;P&gt;Examples of the field&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;&lt;SPAN class=""&gt;id = &lt;SPAN class=""&gt;bdf73ad5-4499-4f70-b7e3-e2c81ae868c3-default-asset-423447&lt;BR /&gt;&lt;BR /&gt;id = bdf73ad5-4499-4f70-b7e3-e2c81ae868c3-default-asset-6672&lt;BR /&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&lt;SPAN class=""&gt;id = &lt;SPAN class=""&gt;bdf73ad5-4499-4f70-b7e3-e2c81ae868c3-default-asset-4232323&lt;BR /&gt;&lt;BR /&gt;I was using....&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&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;&amp;nbsp;&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;| eval stripped_asset_id=substr(id, -6)&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;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp; however that only is consistent if the last numbers consist of 6 digits which it often may have more or less.&lt;BR /&gt;&lt;BR /&gt;How can I take everything after the last dash "-"?&lt;/P&gt;</description>
    <pubDate>Thu, 05 May 2022 22:18:32 GMT</pubDate>
    <dc:creator>morgantay96</dc:creator>
    <dc:date>2022-05-05T22:18:32Z</dc:date>
    <item>
      <title>Help with regex on string with multiple number values</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Help-with-regex-on-string-with-multiple-number-values/m-p/596629#M207689</link>
      <description>&lt;P&gt;Hi all need help getting the trailing number from a field in a search.&lt;/P&gt;
&lt;P&gt;Examples of the field&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;&lt;SPAN class=""&gt;id = &lt;SPAN class=""&gt;bdf73ad5-4499-4f70-b7e3-e2c81ae868c3-default-asset-423447&lt;BR /&gt;&lt;BR /&gt;id = bdf73ad5-4499-4f70-b7e3-e2c81ae868c3-default-asset-6672&lt;BR /&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&lt;SPAN class=""&gt;id = &lt;SPAN class=""&gt;bdf73ad5-4499-4f70-b7e3-e2c81ae868c3-default-asset-4232323&lt;BR /&gt;&lt;BR /&gt;I was using....&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&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;&amp;nbsp;&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;| eval stripped_asset_id=substr(id, -6)&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;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp; however that only is consistent if the last numbers consist of 6 digits which it often may have more or less.&lt;BR /&gt;&lt;BR /&gt;How can I take everything after the last dash "-"?&lt;/P&gt;</description>
      <pubDate>Thu, 05 May 2022 22:18:32 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Help-with-regex-on-string-with-multiple-number-values/m-p/596629#M207689</guid>
      <dc:creator>morgantay96</dc:creator>
      <dc:date>2022-05-05T22:18:32Z</dc:date>
    </item>
    <item>
      <title>Re: Regex on string with multiple number values</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Help-with-regex-on-string-with-multiple-number-values/m-p/596630#M207690</link>
      <description>&lt;P&gt;Try adding this pipe:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;| rex field=id "(?&amp;lt;new_field_name&amp;gt;[^\-]*$)"&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;This will run a lookbehind from the last dash in the end of the string and create a new field with your new field name. In this case id is a field and the full string is that fields value&lt;/P&gt;</description>
      <pubDate>Thu, 05 May 2022 22:14:17 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Help-with-regex-on-string-with-multiple-number-values/m-p/596630#M207690</guid>
      <dc:creator>jnorha</dc:creator>
      <dc:date>2022-05-05T22:14:17Z</dc:date>
    </item>
    <item>
      <title>Re: Help with regex on string with multiple number values</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Help-with-regex-on-string-with-multiple-number-values/m-p/596662#M207695</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://community.splunk.com/t5/user/viewprofilepage/user-id/237721"&gt;@morgantay96&lt;/a&gt;,&lt;/P&gt;&lt;P&gt;you could also try this:&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;| rex field=id "^([^\-]*\-){7}(?&amp;lt;your_field&amp;gt;\d+)"&lt;/LI-CODE&gt;&lt;P&gt;that you can test at&amp;nbsp;&lt;A href="https://regex101.com/r/dDfGBk/1" target="_blank"&gt;https://regex101.com/r/dDfGBk/1&lt;/A&gt;&lt;/P&gt;&lt;P&gt;Ciao.&lt;/P&gt;&lt;P&gt;Giuseppe&lt;/P&gt;</description>
      <pubDate>Fri, 06 May 2022 06:49:14 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Help-with-regex-on-string-with-multiple-number-values/m-p/596662#M207695</guid>
      <dc:creator>gcusello</dc:creator>
      <dc:date>2022-05-06T06:49:14Z</dc:date>
    </item>
    <item>
      <title>Re: Regex on string with multiple number values</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Help-with-regex-on-string-with-multiple-number-values/m-p/596665#M207696</link>
      <description>&lt;P&gt;And if you want to optimise that regex then you can use this if all your id:s have above format.&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;| rex field=id "t-(?&amp;lt;new_field_name&amp;gt;\d+$)"&lt;/LI-CODE&gt;&lt;P&gt;&lt;A href="https://regex101.com/r/2qGsRf/1" target="_blank"&gt;https://regex101.com/r/2qGsRf/1&lt;/A&gt;&amp;nbsp;(3 matches 33 steps)&lt;/P&gt;&lt;P&gt;vs. original&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;A href="https://regex101.com/r/bhW62a/1" target="_blank"&gt;https://regex101.com/r/bhW62a/1&lt;/A&gt;&amp;nbsp;(6 matches 1 354 steps)&lt;/P&gt;&lt;P&gt;No mater if you have only couple of events, but when there are millions or more then this can be meaningful difference.&lt;/P&gt;&lt;P&gt;r. Ismo&lt;/P&gt;</description>
      <pubDate>Fri, 06 May 2022 06:56:22 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Help-with-regex-on-string-with-multiple-number-values/m-p/596665#M207696</guid>
      <dc:creator>isoutamo</dc:creator>
      <dc:date>2022-05-06T06:56:22Z</dc:date>
    </item>
  </channel>
</rss>

