in reply to Re^2: RegEx to remove leading zeros from a hex number
in thread RegEx to remove leading zeros from a hex number

Well, yes. Removing the leading zeros from a string containing only zeros leaves zero zeros. What you do you think should happen? Leaving a string with leading zeros, or a string containing non-zeros? Neither seems to be correct.
  • Comment on Re^3: RegEx to remove leading zeros from a hex number

Replies are listed 'Best First'.
Re^4: RegEx to remove leading zeros from a hex number
by Anonymous Monk on May 17, 2011 at 00:24 UTC
    Write a sub. It is "not nearly as 'clever' as one might think" to write a regex one-liner. A clearly commented subroutine, that includes whatever if-statements it may need to clearly and obviously do its job, is much to be preferred.