Sebastian Tennant <[email protected]> writes:
> Quoth Linas Vepstas <[email protected]>:
>> 2009/4/14 Sebastian Tennant <[email protected]>:
>>> I needed to replace two consecutive spaces in strings with ' ' so
>>
>> Most programming languages use regex, and so does guile:
>
> Of course it can be done using regexps, I'm just a little surprised
> there isn't already a replace-substring function knocking around.
There is, and I guess it's what Linas had in mind:
regexp-substitute/global (from (ice-9 regex)).
For example:
;; Replace forward slashes by backward ones.
(set! path (regexp-substitute/global #f "/" path 'pre "\\" 'post))
Regards,
Neil