Previous: , Up: Replacing Text Using Match Data   [Index]


8.4.4.4 perform-replace

If you want to write a command along the lines of query-replace, you can use perform-replace to do the work.

Function: perform-replace from-string replacements query-flag regexp-flag delimited-flag &optional repeat-count map start end backward region-noncontiguous-p

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.)