<?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: Remove leading zeros from IP address using regex in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/Remove-leading-zeros-from-IP-address-using-regex/m-p/690410#M235149</link>
    <description>&lt;P&gt;That's not a valid rex sed statement, use this example&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;| makeresults 
| eval ip=split("010.1.2.3,10.013.2.3",",")
| mvexpand ip
| rex field=ip mode=sed "s/\b0+\B//"&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Wed, 12 Jun 2024 04:28:09 GMT</pubDate>
    <dc:creator>bowesmana</dc:creator>
    <dc:date>2024-06-12T04:28:09Z</dc:date>
    <item>
      <title>Remove leading zeros from IP address using regex</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Remove-leading-zeros-from-IP-address-using-regex/m-p/690409#M235148</link>
      <description>&lt;P&gt;Hello All,&lt;/P&gt;&lt;P&gt;I'm trying to remove leading zeros in IP addresses using rex and mode=sed . the regular expression I'm trying to use for substitution is "\b0+\B" . However, it's not returning the required output.&lt;/P&gt;&lt;P&gt;Example :&amp;nbsp;| rex field=&amp;lt;IP address field&amp;gt; mode=sed "\b0+\B"&lt;/P&gt;&lt;P&gt;I even tried with double back slash. But, no luck. Kindly assist to resolve this issue.&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Sid&lt;/P&gt;</description>
      <pubDate>Wed, 12 Jun 2024 04:22:38 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Remove-leading-zeros-from-IP-address-using-regex/m-p/690409#M235148</guid>
      <dc:creator>Splunk_sid</dc:creator>
      <dc:date>2024-06-12T04:22:38Z</dc:date>
    </item>
    <item>
      <title>Re: Remove leading zeros from IP address using regex</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Remove-leading-zeros-from-IP-address-using-regex/m-p/690410#M235149</link>
      <description>&lt;P&gt;That's not a valid rex sed statement, use this example&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;| makeresults 
| eval ip=split("010.1.2.3,10.013.2.3",",")
| mvexpand ip
| rex field=ip mode=sed "s/\b0+\B//"&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 12 Jun 2024 04:28:09 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Remove-leading-zeros-from-IP-address-using-regex/m-p/690410#M235149</guid>
      <dc:creator>bowesmana</dc:creator>
      <dc:date>2024-06-12T04:28:09Z</dc:date>
    </item>
    <item>
      <title>Re: Remove leading zeros from IP address using regex</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Remove-leading-zeros-from-IP-address-using-regex/m-p/690427#M235153</link>
      <description>&lt;P&gt;&lt;a href="https://community.splunk.com/t5/user/viewprofilepage/user-id/6367"&gt;@bowesmana&lt;/a&gt;&amp;nbsp; I'm still not getting the expected result. The regex pattern should remove all leading zeros in each octet. however, in this case, it is just removing the leading zero in whichever octet it finds at first place.&amp;nbsp;&lt;/P&gt;&lt;P&gt;For example:&lt;/P&gt;&lt;P&gt;1) 010.1.2.3 -&amp;gt; it removes zero in 1st octet - &amp;gt;&amp;nbsp;10.1.2.3&lt;/P&gt;&lt;P&gt;2) 10.001.2.3 -&amp;gt; it removes zero in 2nd octet -&amp;gt;&amp;nbsp;10.1.2.3&lt;/P&gt;&lt;P&gt;3) 010.001.2.3 -&amp;gt; it removes zero in 1st octet only -&amp;gt;&amp;nbsp;10.001.2.3&lt;/P&gt;&lt;P&gt;4) 10.001.002.3 -&amp;gt; it removes zero in 2nd octet only -&amp;gt;&amp;nbsp;10.1.002.3&lt;/P&gt;&lt;P&gt;5) 10.1.2.003 -&amp;gt; it removes zero in 2nd octet only -&amp;gt;&amp;nbsp;10.1.2.3&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Sid&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 12 Jun 2024 06:10:04 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Remove-leading-zeros-from-IP-address-using-regex/m-p/690427#M235153</guid>
      <dc:creator>Splunk_sid</dc:creator>
      <dc:date>2024-06-12T06:10:04Z</dc:date>
    </item>
    <item>
      <title>Re: Remove leading zeros from IP address using regex</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Remove-leading-zeros-from-IP-address-using-regex/m-p/690435#M235154</link>
      <description>&lt;P&gt;Hi,&lt;BR /&gt;try this sed expression instead&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;...
| rex field=ip mode=sed "s/\b0+([0-9]+)/\1/g"&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;------------&lt;BR /&gt;If this was helpful, some karma would be appreciated.&lt;/P&gt;</description>
      <pubDate>Wed, 12 Jun 2024 06:47:01 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Remove-leading-zeros-from-IP-address-using-regex/m-p/690435#M235154</guid>
      <dc:creator>glc_slash_it</dc:creator>
      <dc:date>2024-06-12T06:47:01Z</dc:date>
    </item>
    <item>
      <title>Re: Remove leading zeros from IP address using regex</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Remove-leading-zeros-from-IP-address-using-regex/m-p/690549#M235175</link>
      <description>&lt;P&gt;My bad, it was missing the 'g' (global) flag at the end&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;| makeresults 
| eval ip=split("010.1.2.3,10.013.2.3,010.001.002.003",",")
| mvexpand ip
| rex field=ip mode=sed "s/\b0+\B//g"&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 12 Jun 2024 21:36:23 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Remove-leading-zeros-from-IP-address-using-regex/m-p/690549#M235175</guid>
      <dc:creator>bowesmana</dc:creator>
      <dc:date>2024-06-12T21:36:23Z</dc:date>
    </item>
  </channel>
</rss>

