" I want to check this line containing an ASCII value between 0 ...">All geek questions in one placeASCII char with regex (java)I have a line like message = "ASDF rfghy !@ #$ :>< "I want to check this line containing an ASCII value between 0 and 255 using regex (java).+4java regex asciiJay patel Dec 13 '11 at 6:24source share3 answersJust use this code to perform this check: System.out.println("Matches: " + message.matches("[\u0000-\u00FF]+")); +1anubhava Dec 13 '11 at 6:38source shareYou can try regex: "^\\p{ASCII}*$" +5codaddict Dec 13 '11 at 6:27source shareIn regex, \x00 matches the hexadecimal character 00 , and character classes work on them. So you can do: /^[\x00-\x7F]+$/ to match a string of one or more ascii values.+2Dan Dec 13 '11 at 6:27source shareSource: https://habr.com/ru/post/1386045/More articles:Symfony2 and Doctrine - returns the database result as an array of arrays in the controller - symfonyreplacing anchor text with image - htmlfast and efficient way to read a contribution-separated file using java - javahttps://translate.googleusercontent.com/translate_c?depth=1&rurl=translate.google.com&sl=ru&sp=nmt4&tl=en&u=https://fooobar.com/questions/1386043/possible-to-connect-to-remote-desktop-with-php&usg=ALkJrhieSqCIoxrQ7NFdWu7scy921p6SZACreating a layered subfolder structure in PHP - directory"application failed to start ... configuration is incorrect" after update? - windowsJMockit and some local methods - javaWorkaround for Android error related to setRetainInstance (true) - androidIL Method call with 2 array arguments using Reflection.Emit - c #Best Practices for Keeping a Permanent Socket Open to the Server for an iOS Application - iosAll Articles
I have a line like message = "ASDF rfghy !@ #$ :>< "
message = "ASDF rfghy !@ #$ :>< "
I want to check this line containing an ASCII value between 0 and 255 using regex (java).
Just use this code to perform this check:
System.out.println("Matches: " + message.matches("[\u0000-\u00FF]+"));
You can try regex:
"^\\p{ASCII}*$"
In regex, \x00 matches the hexadecimal character 00 , and character classes work on them. So you can do:
\x00
00
/^[\x00-\x7F]+$/
to match a string of one or more ascii values.
Source: https://habr.com/ru/post/1386045/More articles:Symfony2 and Doctrine - returns the database result as an array of arrays in the controller - symfonyreplacing anchor text with image - htmlfast and efficient way to read a contribution-separated file using java - javahttps://translate.googleusercontent.com/translate_c?depth=1&rurl=translate.google.com&sl=ru&sp=nmt4&tl=en&u=https://fooobar.com/questions/1386043/possible-to-connect-to-remote-desktop-with-php&usg=ALkJrhieSqCIoxrQ7NFdWu7scy921p6SZACreating a layered subfolder structure in PHP - directory"application failed to start ... configuration is incorrect" after update? - windowsJMockit and some local methods - javaWorkaround for Android error related to setRetainInstance (true) - androidIL Method call with 2 array arguments using Reflection.Emit - c #Best Practices for Keeping a Permanent Socket Open to the Server for an iOS Application - iosAll Articles