On 2020-05-22 8:38 pm, Freeman Gilmore wrote:
Is there a procedure, to replace 'all' occurrences of a sub-string
within a string. with a string?
If so please give an example.

regexp-substitute/global [1] should do the job.

[1]: https://www.gnu.org/software/guile/docs/docs-1.8/guile-ref/Regexp-Functions.html#Regexp-Functions

;;;;

(regexp-substitute/global #f
  "(c|sh|w)ould of"
  "I would of done that if I could of."
  'pre 1 "ould have" 'post)

=> "I would have done that if I could have."

;;;;


-- Aaron Hill

Reply via email to