I'm trying to make a Regex to count leading zeros on the following formats:
01, 001 and 0001.
These are some id's that I need to process somehow.
I tried something like this:
id.split(/^0{1,3}/)
For example, if my input is 0001, I would like to see something like this:
['0', '0', '0']
But I'm getting this:
["", "1"]
I only care about the leading zeros, and I can't count the ones that are after the format I specified.