From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: henry atting Newsgroups: gmane.emacs.help Subject: Re: rexexp help needed Date: Fri, 26 Dec 2008 18:46:04 +0100 Message-ID: <87iqp6x21v.fsf@literaturlatenight.de> References: <87bpuzaugu.fsf@literaturlatenight.de> <87myeix64y.fsf@literaturlatenight.de> NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-Trace: ger.gmane.org 1230313426 11414 80.91.229.12 (26 Dec 2008 17:43:46 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Fri, 26 Dec 2008 17:43:46 +0000 (UTC) Cc: henry atting , help-gnu-emacs@gnu.org To: "Lennart Borgman" Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Fri Dec 26 18:44:53 2008 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.50) id 1LGGjy-0005fo-VV for geh-help-gnu-emacs@m.gmane.org; Fri, 26 Dec 2008 18:44:51 +0100 Original-Received: from localhost ([127.0.0.1]:55481 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1LGGil-0000GU-TA for geh-help-gnu-emacs@m.gmane.org; Fri, 26 Dec 2008 12:43:35 -0500 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1LGGiU-0000GD-F6 for help-gnu-emacs@gnu.org; Fri, 26 Dec 2008 12:43:18 -0500 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1LGGiS-0000Fz-Oo for help-gnu-emacs@gnu.org; Fri, 26 Dec 2008 12:43:17 -0500 Original-Received: from [199.232.76.173] (port=45467 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1LGGiS-0000Fw-J9 for help-gnu-emacs@gnu.org; Fri, 26 Dec 2008 12:43:16 -0500 Original-Received: from mout-xforward.kundenserver.de ([212.227.17.5]:63430) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1LGGiS-0000gY-0h for help-gnu-emacs@gnu.org; Fri, 26 Dec 2008 12:43:16 -0500 Original-Received: from argon (port-92-195-73-213.dynamic.qsc.de [92.195.73.213]) by mrelayeu.kundenserver.de (node=mrelayeu8) with ESMTP (Nemesis) id 0ML31I-1LGGiP0iML-00061e; Fri, 26 Dec 2008 18:43:13 +0100 Original-Received: by argon (Postfix, from userid 1000) id 9B74A339CC; Fri, 26 Dec 2008 18:46:04 +0100 (CET) In-Reply-To: (Lennart Borgman's message of "Fri, 26 Dec 2008 18:11:54 +0100") User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/23.0.60 (gnu/linux) X-Provags-ID: V01U2FsdGVkX1+pXJL7jhjMZj1NLaVhEqjI8Nms4R+S2rmsHFH R4ERBLSFHWZql8/QIMWwNpnIH5C+mFsBT4IpfBoIMlcR1pbtJK BJuqhNsj6k7mONFfy+MHQ== X-detected-operating-system: by monty-python.gnu.org: Genre and OS details not recognized. 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:60938 Archived-At: Zitat - Lennart Borgman * Fr Dez 26 2008 um 18:11 - > On Fri, Dec 26, 2008 at 5:17 PM, henry atting > wrote: >> Zitat - Lennart Borgman * Fr Dez 26 2008 um 15:51 - >> >>> On Fri, Dec 26, 2008 at 3:20 PM, henry atting >>> wrote: >>>> Hi, >>>> >>>> I am trying to build a rexexp that does the following: >>>> I have a text file where I want to replace >>>> >>>> Medicine:One:Two =E2=82=AC12.00 >>>> >>>> With >>>> >>>> Medicine =E2=82=AC12.00 >>>> >>>> Because I have more than one entry `Medicine' (and they >>>> differ slightly, something like `Medicine:Three:Four' and >>>> so on) I have to do it with `quere-replace-regexp'. >>>> With regexp-builder I found this: >>>> >>>> Medicine:.*[^=E2=82=AC.0-9] >>>> >>>> This works both in regexp-builder and a scratch buffer, but >>>> unfortunately not in a file. If applied on a file replace-regexp >>>> strips everything from the first `:'. >>> >>> You have to escape the [] with \. That is a bit tricky since you have >>> to double the escape character. (One for text escaping, one for regexp >>> char escaping.) >> >> >> Mmh, IIRC I tried it already with escape sequences. Anyway, if I do so I >> get: >> >> Replaced 0 occurences >> >> No difference if I try it in a scratch buffer or a file. >> Without escaping it works in a scratch buffer at least. ;) > > Eh, sorry. Everything (nearly) I wrote before was wrong. You do not > need to escape []. Something like this is what you want > > (re-search-forward "Medicine:[^=E2=82=AC]*") Yes, thanks, with `*' at the end it works fine. henry