Skip to content

Instantly share code, notes, and snippets.

@m3hdiii
Created March 4, 2018 02:14
Show Gist options
  • Save m3hdiii/de45340f821d9528d928f3c0941a3fa1 to your computer and use it in GitHub Desktop.
Save m3hdiii/de45340f821d9528d928f3c0941a3fa1 to your computer and use it in GitHub Desktop.
Code For Regex Matching For all letters excepts symbols
public class Test {
public static void main(String[] args) {
String textWithsymbols = "Th!s is For $ & NoT 4 Honey ... !@#$?<>%^&Y~*()_-=+aah جاوا فور اور";
String s = textWithsymbols.replaceAll("[\\\\s\\\\d!\\\"#$%&\\'()*+,-./:;\\\\\\\\<>=?@\\\\^_`{}|~\\\\[\\\\]]","");
System.out.println(s);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment