From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Jim Ottaway Newsgroups: gmane.emacs.help Subject: Re: Help with query-replace-regular expression Date: Mon, 11 Sep 2006 16:57:01 +0100 Message-ID: <87zmd6gzw2.fsf@lse.ac.uk> References: <1157980933.187942.311270@i42g2000cwa.googlegroups.com> <87pse2ijtt.fsf@lse.ac.uk> <87wt8a4do4.fsf@offby1.atm01.sea.blarg.net> NNTP-Posting-Host: main.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Trace: sea.gmane.org 1157990356 20793 80.91.229.2 (11 Sep 2006 15:59:16 GMT) X-Complaints-To: usenet@sea.gmane.org NNTP-Posting-Date: Mon, 11 Sep 2006 15:59:16 +0000 (UTC) Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Mon Sep 11 17:59:09 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 1GMoBO-0004mw-O9 for geh-help-gnu-emacs@m.gmane.org; Mon, 11 Sep 2006 17:58:51 +0200 Original-Received: from localhost ([127.0.0.1] helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1GMoBO-0008S7-7p for geh-help-gnu-emacs@m.gmane.org; Mon, 11 Sep 2006 11:58:50 -0400 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1GMoB3-0008Qb-6f for help-gnu-emacs@gnu.org; Mon, 11 Sep 2006 11:58:29 -0400 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1GMoAx-0008NE-Va for help-gnu-emacs@gnu.org; Mon, 11 Sep 2006 11:58:28 -0400 Original-Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1GMoAx-0008NB-Rf for help-gnu-emacs@gnu.org; Mon, 11 Sep 2006 11:58:23 -0400 Original-Received: from [80.91.229.2] (helo=ciao.gmane.org) by monty-python.gnu.org with esmtps (TLS-1.0:RSA_AES_256_CBC_SHA:32) (Exim 4.52) id 1GMoCF-0002Ag-MD for help-gnu-emacs@gnu.org; Mon, 11 Sep 2006 11:59:44 -0400 Original-Received: from list by ciao.gmane.org with local (Exim 4.43) id 1GMoAJ-0004Vv-Dl for help-gnu-emacs@gnu.org; Mon, 11 Sep 2006 17:57:45 +0200 Original-Received: from 53-186.adsl.zetnet.co.uk ([194.247.53.186]) by main.gmane.org with esmtp (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Mon, 11 Sep 2006 17:57:43 +0200 Original-Received: from j.ottaway by 53-186.adsl.zetnet.co.uk with local (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Mon, 11 Sep 2006 17:57:43 +0200 X-Injected-Via-Gmane: http://gmane.org/ Original-To: help-gnu-emacs@gnu.org Original-Lines: 20 Original-X-Complaints-To: usenet@sea.gmane.org X-Gmane-NNTP-Posting-Host: 53-186.adsl.zetnet.co.uk User-Agent: Gnus/5.11 (Gnus v5.11) Emacs/22.0.50 (gnu/linux) Cancel-Lock: sha1:urCcuvBbvfkh6DpMh/q838faK1Y= 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:37294 Archived-At: Eric Hanchrow writes: > Or escape "escape hell" and let "rx" write the regexp for you: > > (rx "/*#" (group (or (any alpha) "_") > (or (any alnum) "_")) "#*/") > That evaluates to > > "\\(?:/\\*#\\(\\(?:\\(?:[[:alpha:]]\\)\\|_\\)\\(?:\\(?:[[:alnum:]]\\)\\|_\\)\\)#\\*/\\)" I don’t think you need both alpha and alnum, do you?. Anyhow, nice though rx is, you don’t get something that can be used for interactive use of query-replace-regexp, since the escaping is for a string, rather than for text entered in the minibuffer, where you don’t have to double-escape the backslashes. Regards, -- Jim Ottaway