i want to blacklist only some special characters(<,>,%,$,^) from a string and allow everything else. i have been trying some regular expressions but they are not working.for e.g. [^%<>] but its not working.
String s = "script";
if(s.matches("[^%<>\\$]")){
System.out.println("valid");
}else{
System.out.println("invalid");
}
please suggest some solution