From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Neil Jerram Newsgroups: gmane.lisp.guile.user Subject: Re: Replacing substrings in strings Date: Sat, 02 May 2009 01:29:57 +0100 Message-ID: <87presgxdm.fsf@arudy.ossau.uklinux.net> References: <8wm3upbo.fsf@vps203.linuxvps.org> <3ae3aa420904141035k72886cfev460aea61a6079994@mail.gmail.com> NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: ger.gmane.org 1241224257 27706 80.91.229.12 (2 May 2009 00:30:57 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Sat, 2 May 2009 00:30:57 +0000 (UTC) Cc: guile-user@gnu.org To: Sebastian Tennant Original-X-From: guile-user-bounces+guile-user=m.gmane.org@gnu.org Sat May 02 02:30:47 2009 Return-path: Envelope-to: guile-user@m.gmane.org Original-Received: from lists.gnu.org ([199.232.76.165]) by lo.gmane.org with esmtp (Exim 4.50) id 1M037v-00023S-0z for guile-user@m.gmane.org; Sat, 02 May 2009 02:30:47 +0200 Original-Received: from localhost ([127.0.0.1]:43242 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1M037u-0004E9-9N for guile-user@m.gmane.org; Fri, 01 May 2009 20:30:46 -0400 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1M037q-0004E3-Ey for guile-user@gnu.org; Fri, 01 May 2009 20:30:42 -0400 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1M037l-0004Dr-S0 for guile-user@gnu.org; Fri, 01 May 2009 20:30:41 -0400 Original-Received: from [199.232.76.173] (port=40467 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1M037l-0004Do-Mr for guile-user@gnu.org; Fri, 01 May 2009 20:30:37 -0400 Original-Received: from mail3.uklinux.net ([80.84.72.33]:40943) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1M037l-0005fI-Am for guile-user@gnu.org; Fri, 01 May 2009 20:30:37 -0400 Original-Received: from arudy (host86-145-49-20.range86-145.btcentralplus.com [86.145.49.20]) by mail3.uklinux.net (Postfix) with ESMTP id 0C6A41F673C; Sat, 2 May 2009 01:29:58 +0100 (BST) Original-Received: from arudy.ossau.uklinux.net (arudy [127.0.0.1]) by arudy (Postfix) with ESMTP id 407E23801E; Sat, 2 May 2009 01:29:57 +0100 (BST) In-Reply-To: (Sebastian Tennant's message of "Wed\, 15 Apr 2009 07\:04\:23 +0000") User-Agent: Gnus/5.11 (Gnus v5.11) Emacs/22.2 (gnu/linux) X-detected-operating-system: by monty-python.gnu.org: GNU/Linux 2.4-2.6 X-BeenThere: guile-user@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: General Guile related discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: guile-user-bounces+guile-user=m.gmane.org@gnu.org Errors-To: guile-user-bounces+guile-user=m.gmane.org@gnu.org Xref: news.gmane.org gmane.lisp.guile.user:7269 Archived-At: Sebastian Tennant writes: > Quoth Linas Vepstas : >> 2009/4/14 Sebastian Tennant : >>> 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