replace - Is it possible with Eclipse to only find results in string literals? -
lets assume have following java code:
public string foo() { // returns foo() string log = "foo() : logging something!" return log; }
can search in eclipse foo()
occurring in string literal, not anywhere else in code? in example here eclipse should find third occurrance of foo()
, not first one, function name , not second one, comment.
edit: simple regular expressions won't work, because find foo()
in line like
string temp = "literal" + foo() + "another literal"
but here foo()
function name , not string literal.
you can try this:
"[^"\n]*foo\\(\\)[^"\n]*"
you have escape brackets, plus regex not match new lines or additional quotes, prevent wrong matches.
Comments
Post a Comment