Lets say I have these strings: "foo", "fooo" and "fo". And this line of code:
(query-replace-regexp "\\<fo+\\>" "foo" nil (point-min) (point-max))
I'd like to skip the query-replacement for the matched string "foo" because it would be replaced by an identical string.
In other words I'd like to skip query-replacements if the matched string matches a string (or a regexp).
I figured out it could be done with a
lambda function but I have no idea how to implement this idea. May be something like:
(query-replace-regexp "\\<fo+\\>" '((lambda (data count) (if (string= (match-string 0) "foo") (skipping-function) "foo"))) nil (point-min) (point-max))
a sort of
skipping-function should do the trick.