Skip to content

Instantly share code, notes, and snippets.

@Badbird5907
Last active April 28, 2021 02:50
Show Gist options
  • Save Badbird5907/928c8287a0b154eda5e76a14714cac15 to your computer and use it in GitHub Desktop.
Save Badbird5907/928c8287a0b154eda5e76a14714cac15 to your computer and use it in GitHub Desktop.
regex pattern to check if a string has unicode
public class Unicode{
public static boolean containsUnicode(String s){
//you're welcome i did it for you :D
Pattern p = Pattern.compile("[^a-z0-9~!@#$%^&*()_+-={}\\[\\]|:\";'<>?,./\\\\ ]", Pattern.CASE_INSENSITIVE);
Matcher m = p.matcher(s);
return m.find();
}
}
@Badbird5907
Copy link
Author

made code cleaner/smaller

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment