From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: David Kastrup Newsgroups: gmane.emacs.help Subject: Re: query-replace-regexp ... "Invalid repacement string '\.'" Supersedes: <85vencl9ar.fsf@lola.goethe.zz> Date: Mon, 25 Sep 2006 09:02:54 +0200 Organization: Organization?!? Message-ID: <85sligl97l.fsf@lola.goethe.zz> References: <87hcyw78w3.fsf@trick.ulm.malte.spiess> NNTP-Posting-Host: main.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: sea.gmane.org 1159170288 17258 80.91.229.2 (25 Sep 2006 07:44:48 GMT) X-Complaints-To: usenet@sea.gmane.org NNTP-Posting-Date: Mon, 25 Sep 2006 07:44:48 +0000 (UTC) Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Mon Sep 25 09:44:44 2006 Return-path: Envelope-to: geh-help-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([199.232.76.165]) by ciao.gmane.org with esmtp (Exim 4.43) id 1GRl8o-0000Fu-Mo for geh-help-gnu-emacs@m.gmane.org; Mon, 25 Sep 2006 09:44:38 +0200 Original-Received: from localhost ([127.0.0.1] helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1GRl8o-0000fa-5h for geh-help-gnu-emacs@m.gmane.org; Mon, 25 Sep 2006 03:44:38 -0400 Original-Path: shelby.stanford.edu!newsfeed.stanford.edu!news.tele.dk!news.tele.dk!small.news.tele.dk!newsfeed.cw.net!cw.net!news-FFM2.ecrc.de!newsreader.cw.net!newsfeed.stueberl.de!uucp.gnuu.de!newsfeed.arcor.de!newsspool4.arcor-online.net!news.arcor.de.POSTED!not-for-mail Original-Newsgroups: gnu.emacs.help X-Face: 2FEFf>]>q>2iw=B6, xrUubRI>pR&Ml9=ao@P@i)L:\urd*t9M~y1^:+Y]'C0~{mAl`oQuAl \!3KEIp?*w`|bL5qr,H)LFO6Q=qx~iH4DN; i"; /yuIsqbLLCh/!U#X[S~(5eZ41to5f%E@'ELIi$t^ Vc\LWP@J5p^rst0+('>Er0=^1{]M9!p?&:\z]|;&=NP3AhB!B_bi^]Pfkw User-Agent: Gnus/5.11 (Gnus v5.11) Emacs/22.0.50 (gnu/linux) Cancel-Key: sha1:62y+mKDpx1TlSwlqc6MvJw48GOI= Cancel-Lock: sha1:Nc9l8y5SMVTgP4DacYCjgffNBYI= Original-Lines: 40 Original-NNTP-Posting-Date: 25 Sep 2006 09:02:59 CEST Original-NNTP-Posting-Host: 0a782238.newsspool3.arcor-online.net Original-X-Trace: DXC=S=S\LTgb; Hj<6cDJZfMd_cMcF=Q^Z^V3h4Fo<]lROoRa4nDHegD_]RehG0[5oA8>AoCV`H8_`hhQd^9QSCVg3dOflR6Na@Ufk Original-X-Complaints-To: usenet-abuse@arcor.de Original-Xref: shelby.stanford.edu gnu.emacs.help:141982 Original-To: help-gnu-emacs@gnu.org 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:37602 Archived-At: [Oops, superseded] Malte Spiess writes: > "s. keeling" writes: > >> Hi. I was trying to make it easy on myself using q-r-r replacing >> '[^\]\.' (not a backslash, followed by a literal dot/period) with the >> string (sans quotes) '\.', essentially "escaping" every dot/period in >> the file. "M-x query-replace" had no trouble with it but M-x >> query-replace-regexp refused, spouting the error message in the >> subject. > > In a regexp for a "\" you need to escape, so write "\\". "\]" is a > mistake. No, it isn't. Inside of [], \ is not special. > A correct regexp for your intention should be > '[^\\]\.' > -- > >> So how do you replace '.' with '\.' in emacs? > > That should be fine. Maybe something like M-x query-replace-regexp RET \(^\|[^\]\)\. RET \1\\. RET Or even M-x query-replace-regexp RET \(\(^\|[^\]\)\(\\\\\)*\)\. RET \1\\. RET (which considers a dot preceded by an even number of backslashes as unescaped). -- David Kastrup, Kriemhildstr. 15, 44793 Bochum