I am trying to do a search and replace in eclipse on the imports in my java file but I cant get the search to match the imports I want.
In short I want to match all import statements except ones that end with a particular string.
so far I have ^import\s.*[^{STRINGTEXT}];$
but this does not return the results I need. I have tried using related expressions from other questions on this site but none seem to work...I would guess that this is a special case. Any help would be appreciated
With a small lookbehind you can do it easily
^import.*?(?<!BADSTRING);$
It match import then all chars up to ;
, checking that ;
not preceded by BADSTRING