Skip to Main Content

Java Programming

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!

how do I make whitespace optional in a regular expression?

807589Dec 29 2008 — edited Dec 30 2008
I want to match "this is a test" regardless of how many spaces (or tabs and newlines) it has between all the words. I am not sure if I am doing it right though..This is what I have
this (\s*)?is (\s*)?a (\s*)?test
Thanks!
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Jan 27 2009
Added on Dec 29 2008
17 comments
2,827 views