jQuery in Action, 2nd edition
The moose likes Java in General and the fly likes Reg. Expr. using Pattern - Invalidate a String, if it contains certain characters Big Moose Saloon
  Search | Java FAQ | Recent Topics
Register / Login
JavaRanch » Java Forums » Java » Java in General
Reply Bookmark "Reg. Expr. using Pattern - Invalidate a String, if it contains certain characters" Watch "Reg. Expr. using Pattern - Invalidate a String, if it contains certain characters" New topic
Author

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

Sam Gehouse
Ranch Hand

Joined: Jul 21, 2003
Posts: 281
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

Joined: Oct 27, 2005
Posts: 19216

Check out character classes on the java.util.regex.Pattern Javadoc page.


SCJP 1.4 - SCJP 6 - SCWCD 5
How To Ask Questions How To Answer Questions
 
I agree. Here's the link: http://ej-technologies/jprofiler - if it wasn't for jprofiler, we would need to run our stuff on 16 servers instead of 3.
 
subject: Reg. Expr. using Pattern - Invalidate a String, if it contains certain characters
 
Similar Threads
regular pattern
pattern Match without using Pattren or RegulaExpression
How to check whether the string contains only the specified characters?
Can you simulate String.replace(...) & String.contains(...)
How to find if there is a number in a string using regular expressions.