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!

Interested in getting your voice heard by members of the Developer Marketing team at Oracle? Check out this post for AppDev or this post for AI focus group information.

RegEx String Negation

807580Sep 24 2009 — edited Sep 25 2009
Hello,

I'm trying to find a regular expression that will match any file URI in the WEB-INF/lib directory and the jars within it except a couple of specific jars, let's say a.jar and b.jar.

For instance, I'd like the expression to match WEB-INF/lib/c.jar/myClass.class and WEB-INF/lib/d.jar/myClass.class but not any file inside and including the WEB-INF/lib/a.jar and WEB-INF/lib/b.jar

From what I understand so far, it would be ideal if I could somehow group a literal string "a.jar" and "b.jar" into two distinct entities, E1 and E2 and use negation brackets to something of the effect WEB-INF/lib/[^E1E2].* which would match everything that begins with WEB-INF/lib except those strings directly followed by E1 and E2, a.jar and b.jar respectively.

Is there a way to do this?
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Oct 23 2009
Added on Sep 24 2009
15 comments
475 views