I have written a regex to exclude particular numbers 00, 000, and 255
I'm using regex - ^((?!255|00|000)[1-9]*)$
The problem I'm facing is when i enter 80
or any other number ending with 0
it excludes that number also which i don't want
I have written a regex to exclude particular numbers 00, 000, and 255
I'm using regex - ^((?!255|00|000)[1-9]*)$
The problem I'm facing is when i enter 80
or any other number ending with 0
it excludes that number also which i don't want
Try this version:
^(?!(?:255|00|000)$)[0-9]*$
The major change I made was to allow any digits after the negative lookahead assertion. This should be OK, because at that point you have already asserted that your blacklist numbers 00
, 000
, and 255
do not appear.