[Solved] Regex Pattern not alow zero [closed]


I would use a negative lookahead assertion to make the regex fail if it is only “0”.

@"^-?(?!0*(\.0*)?$)(0\.\d*[0-9]|[0-9]\d*(\.\d+)?)$

See it here on Regexr

This expression (?!0*(\.0*)?$) makes the whole regex fail, if the number consists only of zeros.

0

solved Regex Pattern not alow zero [closed]