[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Replace sub-string
From: |
Aaron Hill |
Subject: |
Re: Replace sub-string |
Date: |
Fri, 22 May 2020 21:31:01 -0700 |
User-agent: |
Roundcube Webmail/1.4.2 |
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