This week's book giveaways are in the Cloud and AI/ML forums. We're giving away four copies each of Cloud Native Patterns and Natural Language Processing and have the authors on-line! See this thread and this one for details.
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