Regex for leading zeros and exclude normal zeros -
i looking 2 traverse list of alphanumerics this:
0012-0103
i want remove leading zeros keep ones belong given number value.
i have gets zeros:
/0*([1-9][0-9])?0/
any suggestions. still review regex documentation.
you can use following:
\b0+
see demo
explanation:
\b
word boundary.. check boundaries separated word , non word (digits part of word)0+
match more 1 zeros
therefore, match zeros not in middle..
Comments
Post a Comment