in reply to Remove zero padding from excel mangled Ip addresses

Sounds like you want to remove leading zeroes, which appear to be defined as: one or more zeros that appear at the beginning of the line or following a dot or comma, and preceding a digit. This probably won't be the shortest or most elegant method, but it uses simple concepts and doesn't require any recent regex features:

s/(^|[.,])0+(\d)/$1$2/g;

Aaron B.
My Woefully Neglected Blog, where I occasionally mention Perl.

Replies are listed 'Best First'.
Re^2: Remove zero padding from excel mangled Ip addresses
by GrandFather (Saint) on Mar 21, 2012 at 01:54 UTC

    What "recent regex features" are you avoiding? If you mean the look around anchors, they have been there at least since Perl 5.8.8 (http://perldoc.perl.org/5.8.8/perlre.html) which was released before some Perl monks were born.

    True laziness is hard work

      I wasn't avoiding any in particular; just acknowledging that there are probably newer features which would make a simpler regex than my "capture the characters on each side to get rid of what's between them" method. But that's the method that comes to mind most easily for me, for whatever reason, so I thought a newbie might get something out of it as another way to do it.

      Aaron B.
      My Woefully Neglected Blog, where I occasionally mention Perl.