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!

negation of a phrase in regular expressions

807606Apr 19 2007 — edited Apr 19 2007
Hi,

I'm building a regular expression, and can't seem find a way to negate a phrase.

I need to find the following phrase
*.png

But to receive false for:
*/GeneratedImage/*.png

I've tried using the following negation lookahead:
String regexp = "/.*/(!?GeneratedImage)/.*\\.png";

But the following line returnes true instead of false:
pattern.matcher("/a/GeneratedImage/zxc.png").find());

HELP! I'm dying here... :(

Thanks,
Rahav
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on May 17 2007
Added on Apr 19 2007
1 comment
276 views