[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Help with query-replace-regular expression
From: |
Jim Ottaway |
Subject: |
Re: Help with query-replace-regular expression |
Date: |
Mon, 11 Sep 2006 16:57:01 +0100 |
User-agent: |
Gnus/5.11 (Gnus v5.11) Emacs/22.0.50 (gnu/linux) |
Eric Hanchrow <offby1@blarg.net> 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