From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Teemu Likonen Newsgroups: gmane.emacs.help Subject: Re: reduce repeated backslashes Date: Mon, 15 Feb 2010 10:51:28 +0200 Organization: A noiseless patient Spider Message-ID: <87ljeuc25r.fsf@mithlond.arda> References: NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: ger.gmane.org 1266226881 22920 80.91.229.12 (15 Feb 2010 09:41:21 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Mon, 15 Feb 2010 09:41:21 +0000 (UTC) To: help-gnu-emacs@gnu.org Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Mon Feb 15 10:41:18 2010 Return-path: Envelope-to: geh-help-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([199.232.76.165]) by lo.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1NgxS8-0000Qs-KA for geh-help-gnu-emacs@m.gmane.org; Mon, 15 Feb 2010 10:41:16 +0100 Original-Received: from localhost ([127.0.0.1]:35513 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1NgxS7-0000Xp-Nx for geh-help-gnu-emacs@m.gmane.org; Mon, 15 Feb 2010 04:41:15 -0500 Original-Path: news.stanford.edu!usenet.stanford.edu!news.glorb.com!news2.glorb.com!feeder.erje.net!feeder.eternal-september.org!eternal-september.org!.POSTED!not-for-mail Original-Newsgroups: gnu.emacs.help Original-Lines: 17 Injection-Date: Mon, 15 Feb 2010 08:51:29 +0000 (UTC) Injection-Info: news.motzarella.org; posting-host="TcTTtsh3Iz4M1vNcTNIcFQ"; logging-data="17086"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1+IksZ5nOnr4zlOPVNhpUHpUwBcpe2tcnA=" User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/23.1 (gnu/linux) Cancel-Lock: sha1:901mdTlqjbJpdcp/JS3GWhPFr1s= sha1:qmtE9TUP2id42MMG9eNMyuEF/c8= Original-Xref: news.stanford.edu gnu.emacs.help:176797 X-BeenThere: help-gnu-emacs@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Users list for the GNU Emacs text editor List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Errors-To: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.help:71869 Archived-At: * 2010-02-15 09:40 (+0100), Andreas Roehler wrote: > don't know how to replace/reduce repeated backslashes from inside a > string. > > Let's assume "abcdef\\\\" What is the end result you want? I guess: (replace-regexp-in-string "\\\\\\\\" "\\" "abcdef\\\\" nil t) => "abcdef\\" There are 8 backslashes in the regexp string because backslash is a meta character in Lisp strings and also in regexps. 8 backslashes in a regexp Lisp string means 2 literal backslashes. In the resulting string there is only one backslash but it is displayed as two "\\" because it's a printed representation of Lisp string.