Last active
April 28, 2021 02:50
-
-
Save Badbird5907/928c8287a0b154eda5e76a14714cac15 to your computer and use it in GitHub Desktop.
regex pattern to check if a string has unicode
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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(); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
made code cleaner/smaller