I need to replace all occurrences of abc
with xyz
, but only if they occur in Javadoc comments.
I am using Eclipse.
I believe requiring simply that the line starts either with \s*\*
or \s/\*
should be sufficient for my purposes (no need to match for "occurs between /**
and */
", but that would work fine too).
I tried using: (\s\*|\s/\*)(.*)abc
and replacing with $1$2xyz
but the problem is that the regex is greedy so it gives me only the longest line that matches my string (i.e., I can only replace the last abc
on any given line). Is there any way to ask it for all the possibilities, or is that outside of the scope of (non-recursive) regular expressions?
If it is outside the scope, would a recursive expression work? (Which Eclipse does not support in any case).