Regex str.matches failure
in
Programming Questions
•
1 year ago
I am trying to check if a string matches the condition of having between 1-4 digits followed by a comma and 1-4 digits, for example: 0,0 = true, 1234,6 = true, 0,0, = false.
- if (myString.matches("\\d{1,4},\\d{1,4}")) {
trimmedString = trim(myString);
}
else {
trimmedString = "0";
println("Bad data detected: "+myString);
}
1