RosettaCodeData/Task/Regular-expressions/Common-Lisp/regular-expressions-5.lisp

7 lines
232 B
Common Lisp
Raw Permalink Normal View History

2013-04-10 23:57:08 -07:00
[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"