I have a string like message = "ASDF rfghy !@#$ :>< "
I want to check this string contain ASCII value between 0 to 255 using regex(java).
I have a string like message = "ASDF rfghy !@#$ :>< "
I want to check this string contain ASCII value between 0 to 255 using regex(java).
In regex, \x00
matches the hex character 00
and character classes work on these. So you can do:
/^[\x00-\x7F]+$/
to match a string of one or more ascii values.
Just use this code to do this check:
System.out.println("Matches: " + message.matches("[\u0000-\u00FF]+"));