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 to check if there is any other character than "0" - regex?

807603Feb 21 2008 — edited Feb 22 2008
Hi Guys
Simple if i have few strings eg "00000000000" or "000F0000000" or "a0000000"

how do I find using regex, that whether the strings has any other value than 0 OR they all all 0s.

i tried Pattern.compile("[^0]"); on above strings,
Then I use pattern.matcher for above strings

I expect false, true, true for above strings respectively? but it returns false for all of the strings

please help.
thanks
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Mar 21 2008
Added on Feb 21 2008
22 comments
460 views