Pattern pattern = Pattern.compile("!@#$%"); // String which you want to restrict
Matcher matcher = pattern.matcher("stringToBeMatched"); // String that needs to be matched (may be entered by user for First Name)
matcher.find(); // returns true if string matched else false is returned
Perform action as per the output is returned.
Ashwini Kashyap | www.infocepts.com
Joined: Oct 13, 2005
You would have to unpack the JVM code to try and work out the algorithm used. Try googling; there are probably sites which show the algorithm.