I need to create a RegEx (that works in Eclipse’s search/replace) that will match a group of letters only if a different match occurs anywhere prior in the same sentence.
Specifically, I need to match .css only if it occurs in the same line that includes jsSrc.
Eclipse doesn’t support indefinite lookbehinds.
Example:
<link rel="stylesheet" type="text/css" href="<% { out.print( jsSrc( request, "/builder/builder.css" />
Attempted regEx:
\.css(?<=jsSrc)
Does not produce a match of .css
You used the lookbehind
?<=the wrong way, here is the sample from bookMastering Regular Expression: provide you have stringsee Jeffs book, and you replace(?<=\b Jeff)(?=s\b)with', you will getsee Jeff's bookIn your case, there’s no need to use lookbehind:
works for me.
Maybe you want replace only
.csspart withXXX, then you can do it like this:In
Find:field, input(jsSrc.*)\.cssand inReplace with:field , input\1XXX