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

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

Re: regex with [_A-Z] not working as I expect


From: Jérôme M. Berger
Subject: Re: regex with [_A-Z] not working as I expect
Date: Thu, 10 May 2012 19:13:48 +0200
User-agent: Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.8.1.24) Gecko/20120206 Thunderbird/2.0.0.24 Mnenhy/0.7.6.666

AngusC wrote:
> I expected to be able to do things like this:
> 
> Example text to find
> 1, Passed,0,Q_Mitel2_with_hub_Env1,1,
> 1, Passed,0,Q_Mitel2_with_hub_Env2,1,
> 1, Passed,0,Q_Mitel2_with_hub_Env3,1,
> 
> But if my regex search string is
> ^1, Passed,0,[_A-Za-z0-9]
> 
> Then it only finds text up to 1, Passed,0,Q
> 
> How do I get it to find all of text like A_BC_D and A_CCCCCC_S

        Putting a set of characters between square brackets will only match
one character from the set. You can then use the usual repetition
operators (?, *, or +) to match more than one character (so in your
case, ^1, Passed,0,[_A-Za-z0-9]+ should do what you want).

                Jerome
-- 
mailto:jeberger@free.fr
http://jeberger.free.fr
Jabber: jeberger@jabber.fr

Attachment: signature.asc
Description: OpenPGP digital signature


reply via email to

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