Skip to Main Content

New to Java

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

White space in regular expressions (Pattern class)

807601Mar 15 2008 — edited Mar 15 2008
Hello,

I have to check if a String contains ONLY the following characters: a-z, A-Z, ' and ( ) .

The regular expression that I wanted to use with the Pattern class was [[a-zA-Z][\u0027][\u0028][\u0029][\s]] .

Now, my compiler (Eclipse) doesnt recognize \s as an expression. Is this the proper expression for a white space?
Also, in this notation, will the Pattern check for the order of the characters, cause the order isn't supposed to matter.

I would appreciate any help you could give me on this subject.

With Best Regards, Roderick
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Apr 12 2008
Added on Mar 15 2008
9 comments
2,097 views