In Java I want to use Pattern.compile(String regexp) to find a negative or positive integer or decimal.
Ex. (1) (11) (1.1) (11.11) (-1) (-11) (-1.1) (-11.11)
I have found several answers online that tell me this is the correct regexp, but it ignores "-" sign ever single time.
Pattern pattern1 = Pattern.compile("(\\-?\\d+(\\.\\d+)?)");
Aucun commentaire:
Enregistrer un commentaire