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
This one should work:
import .*(?!StoreModelTestCase){1};$
But I think it is not a really good idea, because, you can also use full qualified classnames within the source later.
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
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.