Win a copy of Re-engineering Legacy Software this week in the Refactoring forum
or Docker in Action in the Cloud/Virtualization forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Reg. Expr. using Pattern - Invalidate a String, if it contains certain characters

 
Sam Gehouse
Ranch Hand
Posts: 281
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I admit that I am not good with regular expression. If any of you is good with regular expression, could you please suggest a pattern that will help me?

This is the problem statement:
If an input String contains any of the following 16 characters (e.g. !, @, =, etc.) that that input String is invalid.
 
Rob Spoor
Sheriff
Pie
Posts: 20495
54
Chrome Eclipse IDE Java Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Check out character classes on the java.util.regex.Pattern Javadoc page.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic