Previous: replace-regexp-in-string, Up: Replacing Text Using Match Data [Index]
If you want to write a command along the lines of query-replace
, you can use
perform-replace
to do the work.
This function is the guts of ‘query-replace’ and related commands.
It searches for occurrences of FROM-STRING in the text between positions START and END and replaces some or all of them. If START is ‘nil’ (or omitted), point is used instead, and the end of the buffer’s accessible portion is used for END. (If the optional argument BACKWARD is non-‘nil’, the search starts at END and goes backward.)