help-gnu-emacs
[Top][All Lists]
Advanced

[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 15:01:02 +0100
User-agent: Gnus/5.11 (Gnus v5.11) Emacs/22.0.50 (gnu/linux)

jade_lindquist@hotmail.com writes:

> I'm struggling with emacs' implementation of regexp. I'd certainly
> appreciate some pointers.
>
> I'd like to replace lines like: /*#midp1_0#*///<editor-fold>
>
> with:
>
> //#if midp1_0
>
> the phrase midp1_0 could be debug or some other alpha plus _ sequence
>
> Thus I've tried M-x query-tags-regexp:
> from:  \\/\\*\\#\\([a-zA-Z_]+\\).*
> to: //#if \\1
>
> but I don't get any matches.
>
> Pehaps I need to escape other characters?

You need fewer escapes, and to add 0-9 to the character alternatives:

M-x query-replace-regexp 
from: /\*#\([a-zA-Z0-9_]+\)#\*///<editor-fold>  
to: //#if \1

or you can use a character class:
from: /\*#\([[:alnum:]_]+\)#\*///<editor-fold>

Regards,

-- 
Jim Ottaway





reply via email to

[Prev in Thread] Current Thread [Next in Thread]