My code is as follows:
String realNumber = "[+-]?[\\d]+(?:[\\.][\\d]+)?";
s.next(realNumber + "[\\s]+" + realNumber);
Full regex:
[+-]?[\\d]+(?:[\\.][\\d]+)?[\\s]+[+-]?[\\d]+(?:[\\.][\\d]+)?
This doesn't work. If I use s.next(realNumber); it works fine for a single real number, i.e. 321.1 or 12 etc. The space is the part that seems to throw the mismatch exception.
I have been trying to get this to work for the past hour now >.> Please help!
Patterns that should match:
1 1
1.1 2.1
123 1.123
123.123 1
Thanks,
CF
Aucun commentaire:
Enregistrer un commentaire