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

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Trouble with regexp


From: Pascal Bourguignon
Subject: Re: Trouble with regexp
Date: Tue, 25 Oct 2005 19:54:11 +0200
User-agent: Gnus/5.11 (Gnus v5.11) Emacs/22.0.50 (gnu/linux)

"rgb" <address@hidden> writes:

>> %token FOO_Alter
>>
>> where 'FOO' is always 'FOO' but 'Alter' is variable.
>> I'd like to convert these lines to:
>>
>>   t_foo_Alter = 'Alter';
>
> Does this work?
>
> %token FOO_\([a-zA-Z]+\)
> t_foo_\1 = '\1';

Given the input file, I'd wouldn't bother matching the exact
characters (you could have digits and underlines) and use:
 
%token FOO_\([^ ]*\)
t_foo_\1 = '\1';

-- 
__Pascal Bourguignon__                     http://www.informatimago.com/
Cats meow out of angst
"Thumbs! If only we had thumbs!
We could break so much!"


reply via email to

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