Skip to content
Advertisement

Regex -> match a number between 000001 and 999999

I’m on Linux and I need to do an expr in order to match 6 digits with this range : 000001 to 999999

I’m stuck with '[0-9]{5}[1-9]' but I can’t match numbers which end with 0 like 000010 I was thinking about '[0-9]{6}|?![0]{6}' in order to eliminate “000000”

How can I use ?! and/or are there any other solutions?

EDIT : solution = ((?!000000)[0-9]{6})

Advertisement

Answer

solution = ((?!000000)[0-9]{6})

User contributions licensed under: CC BY-SA
2 People found this is helpful
Advertisement