A simple regular expression to match leading zeros. Can be used to remove all leading zeros from integers in a string.
/\b0+/g
Matches:
- 010
- 010 020 030
- 000123
- 001.123
Non-matches:
- 123
- abc
- 123abc
A simple regular expression to match leading zeros. Can be used to remove all leading zeros from integers in a string.
/\b0+/g