<?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: Regex a value in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/Regex-a-value/m-p/533300#M150679</link>
    <description>&lt;P&gt;Apologies, for some reason it was working fine in regex101&lt;/P&gt;&lt;P&gt;&lt;A href="https://regex101.com/r/Wlrjiv/1" target="_blank"&gt;https://regex101.com/r/Wlrjiv/1&lt;/A&gt;&lt;/P&gt;&lt;P&gt;Try another version - tested in Splunk&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;| makeresults |eval hosts="aks-agentpool-60893500-2 aks-nodes-15133334-vmss000002"|makemv hosts|mvexpand hosts
|rex field=hosts "(?&amp;lt;host&amp;gt;.*(?=vmss)\D+|.+)"&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Wed, 16 Dec 2020 09:10:23 GMT</pubDate>
    <dc:creator>renjith_nair</dc:creator>
    <dc:date>2020-12-16T09:10:23Z</dc:date>
    <item>
      <title>Regex a value</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Regex-a-value/m-p/533263#M150666</link>
      <description>&lt;P&gt;Hello,&lt;/P&gt;&lt;P&gt;I have multiple values for a field in my search results and they look like the ones below. Can you show me the condition to regex the second value so that it becomes "aks-nodes-15133334-vmss" without the trailing numbers after vmss? At the same time, I would like to maintain value 1 as it is since it doesn't have "vmss" in the trailing name. So, if the value contains vmss, remove the trailing numbers but if there's no vmss in the value, let the value remains at it is.&lt;/P&gt;&lt;P&gt;Before&lt;/P&gt;&lt;P&gt;1) aks-agentpool-60893500-2&lt;BR /&gt;2) aks-nodes-15133334-vmss000002&lt;/P&gt;&lt;P&gt;After&lt;/P&gt;&lt;P&gt;1) aks-agentpool-60893500-2&lt;BR /&gt;2) aks-nodes-15133334-vmss&lt;/P&gt;&lt;P&gt;If I do this (?&amp;lt;host&amp;gt;.+\D), it will make item 2 looks like aks-nodes-15133334-vmss but it makes item 1 looks like aks-agentpool-60893500-&lt;/P&gt;&lt;P&gt;Thank you for your help.&lt;/P&gt;</description>
      <pubDate>Wed, 16 Dec 2020 03:18:51 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Regex-a-value/m-p/533263#M150666</guid>
      <dc:creator>timyong80</dc:creator>
      <dc:date>2020-12-16T03:18:51Z</dc:date>
    </item>
    <item>
      <title>Re: Regex a value</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Regex-a-value/m-p/533267#M150668</link>
      <description>&lt;P&gt;Try&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;(?&amp;lt;host&amp;gt;.*(vms)?\D)&lt;/LI-CODE&gt;</description>
      <pubDate>Wed, 16 Dec 2020 04:12:19 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Regex-a-value/m-p/533267#M150668</guid>
      <dc:creator>renjith_nair</dc:creator>
      <dc:date>2020-12-16T04:12:19Z</dc:date>
    </item>
    <item>
      <title>Re: Regex a value</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Regex-a-value/m-p/533283#M150675</link>
      <description>&lt;P&gt;Thanks. It works for no.2 but for no.1, it regex the value as "aks-agentpool-60893500-" (without the 2).&lt;/P&gt;</description>
      <pubDate>Wed, 16 Dec 2020 07:14:50 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Regex-a-value/m-p/533283#M150675</guid>
      <dc:creator>timyong80</dc:creator>
      <dc:date>2020-12-16T07:14:50Z</dc:date>
    </item>
    <item>
      <title>Re: Regex a value</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Regex-a-value/m-p/533300#M150679</link>
      <description>&lt;P&gt;Apologies, for some reason it was working fine in regex101&lt;/P&gt;&lt;P&gt;&lt;A href="https://regex101.com/r/Wlrjiv/1" target="_blank"&gt;https://regex101.com/r/Wlrjiv/1&lt;/A&gt;&lt;/P&gt;&lt;P&gt;Try another version - tested in Splunk&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;| makeresults |eval hosts="aks-agentpool-60893500-2 aks-nodes-15133334-vmss000002"|makemv hosts|mvexpand hosts
|rex field=hosts "(?&amp;lt;host&amp;gt;.*(?=vmss)\D+|.+)"&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 16 Dec 2020 09:10:23 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Regex-a-value/m-p/533300#M150679</guid>
      <dc:creator>renjith_nair</dc:creator>
      <dc:date>2020-12-16T09:10:23Z</dc:date>
    </item>
  </channel>
</rss>

