Next: irregex chunk, Previous: irregex match, Up: irregex [Index]
Match a pattern in a string, and replaces it with a (possibly empty) list of substitutions. Each replacement can be either a string literal, a numeric index, a symbol (as a named submatch), or a procedure which takes one argument (the match object) and returns a string.
irregex-replace
will replace only the first match, while
irregex-replace/all
will replace all of them.
Examples:
(irregex-replace "[aeiou]" "hello world" "*") ⇒ "h*llo world" (irregex-replace/all "[aeiou]" "hello world" "*") ⇒ "h*ll* w*rld"