I’ve been reading the Java docs (http://docs.oracle.com/javase/tutorial/essential/regex/matcher.html) but am having trouble achieving what I want to do. I want to check if the data my user has entered into a text area only contains letters A to Z and ( and ). I’m trying to make an if-statement return false if it doesn’t match.
I have tried to do this, but it seems to just accept anything when I try so any help would be appreciated.
If it’s just a regular expression you are looking for then i think this does what you need.
EDIT (corrected based on comments from @dbaupp and @tchrist)
If you want to include numbers you can modify it like this:
and with some punctuation … say (.!,)