java - Regular expression of -digit -
java - Regular expression of -digit -
i need regular look match strings : -2,-3,-10,-100 ...
i know regular look of number \\d
how can negation before it?
can help me?
assuming don't want match strings "-0"
, "-0123"
, want look
"-[1-9]\\d*"
which requires have minus sign, digit 1 9, , number of additional digits - or none of them. additional digits might include 0. first backslash there escape sec one; , strictly speaking isn't part of regular expression.
java regex
Comments
Post a Comment