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!

Regex Help: Word not following by another word

807605Aug 23 2007 — edited Aug 26 2007
Hi,

I am trying to write a regex that would return me lines containing a given string but it should not be followed by another.

Lets say the lines in the sample file are as follows:

ABC.EXE
ABC.PDF
ABC.TXT
ABC.DOC

RegEx I used is as follows:

^.*ABC.*(?!EXE)$

I want the RegEx to match all lines except the first, looks like the look ahead is not work.
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Sep 23 2007
Added on Aug 23 2007
23 comments
259 views