Emacs: xah-replace-pairs.el ๐ฆ
what is xah-replace-pairs.el
xah-replace-pairs.el is a emacs lisp package for doing multi-pair find replace.
(the package was named โxfrp_find_replace_pairs.elโ)
Here's a sample use:
(require 'xah-replace-pairs) (xah-replace-pairs-in-string "abcdef" [["a" "1"] ["b" "2"] ["c" "3"]]) ;; returns "123def"
Download
Exported Functions
The package has these functions:
xah-replace-pairs-regionxah-replace-pairs-in-stringxah-replace-regexp-pairs-regionxah-replace-regexp-pairs-in-stringxah-replace-pairs-region-recursivexah-replace-pairs-in-string-recursive
For each function, there's a plain text version and a regex version. They are separate functions so it's simpler for user.
Each function also has a string and region version. The string version works on a given string, the region version works on a region in buffer.
Usage Examples
Find Replace Feedback Loop Problem
xah-replace-pairs-in-string and xah-replace-pairs-region do not have Find Replace Feedback Loop Problem.
It guarantees that a replacement is done IF AND ONLY IF the original input string contains a substring in one of your find string.