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.
foo
withfoo
?("Journal Name" . "Abbreviation")
) (journal name is downcased) and I use this list for more purposes. One of these is query-replace "Journal Name" with "Abbreviation", but some times they are the identical so the query-replace is a wast of time. I solved with something like(unless (string= (car COUPLE) (downcase (cdr COUPLE))) ...)
in mydolist
loop but the question remains interesting for further purposes.