Regular Expression character classes failing?
Answered
- Need more info
- Answered
- Working on it
in
Programming Questions
•
3 years ago
I want to check a string (like the one below) for non-integers and non-whitespace:
- String data = "9 11 6 8 4 14 3 13 5 7 10 12 16 2 15 1";
- String[] is_integers = match(data, "[\D\W]");
- if (is_integers != null) {
- (there are non-digits and non-whitespace in the string...)
- match(data, "[^0-9 \n\r]");
1