nix, shell, perl, php, mysql and mac os x tips and tricks

Thursday, December 2, 2010

Strip leading zeroes using regex

Doesn't actually "strip", rather captures the non-laeding-zero number. Works only on a string that only contains numbers, and is compatible with ancient regex versions.
NOTE: will NOT match a number that doesn't have leading zeroes