Dear Masters! Is it possible to ensure, that only characters with codes between 0 and 255 will be accepted by regular expression, but all with the codes up to 256 not? Thank you!
+2
A:
Yes, you can represent hex ranges in regex:
boolean matches = string.matches("[\\x00-\\xFF]+");
This will match everything which contains at least one character in the 0x00-0xFF range.
BalusC
2010-03-29 12:19:22
A:
You can match [\x00-\xFF]
, i.e. the range of characters between 0 and 255.
liwp
2010-03-29 12:20:09