I need to come up with a RegEx expression that will work with Eclipse’s search.
It needs to find every occurance of ‘script’ that does not have ‘jsSrc’.
I’ve tried these with no luck (using negative lookaheads and lookbehinds)
(?!jsSrc)script(?<!=jsSrc)
Would not match this:
<script type="text/javascript" src="<% { out.print( jsSrc( request, "/config/pop.config.jsp" ) ); } %>"></script>
But would match this:
<script type="text/javascript" src="/config/pop.config.jsp"></script>
What would be the best expression to use that works in the Eclipse IDE search?
Thanks!
Try this:
It will match “<script” if it is not followed by some text that contains “jsSrc”.
Alternatively, this will match the whole line:
Here is the test data that I used:
Only lines 2, 4, and 5 matched using these expressions. Note that I only tested this with single-line expressions, not multi-line ones.