RosettaCodeData/Task/Regular-expressions/Common-Lisp/regular-expressions-5.lisp
2023-07-01 13:44:08 -04:00

6 lines
232 B
Common Lisp

[2]> (defun regexp-replace (pat repl string)
(reduce #'(lambda (x y) (string-concat x repl y))
(regexp:regexp-split pat string)))
REGEXP-REPLACE
[3]> (regexp-replace "x\\b" "-X-" "quick foxx jumps")
"quick fox-X- jumps"