From: "\"Jérôme M. Berger\"" <jeberger@free.fr>
To: help-gnu-emacs@gnu.org
Subject: Re: regex with [_A-Z] not working as I expect
Date: Thu, 10 May 2012 19:13:48 +0200 [thread overview]
Message-ID: <jogt0c$2qb$1@dough.gmane.org> (raw)
In-Reply-To: <33763671.post@talk.nabble.com>
[-- Attachment #1: Type: text/plain, Size: 770 bytes --]
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 #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 198 bytes --]
next prev parent reply other threads:[~2012-05-10 17:13 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-05-10 10:28 regex with [_A-Z] not working as I expect AngusC
2012-05-10 17:13 ` "Jérôme M. Berger" [this message]
2012-05-10 17:15 ` Peter Dyballa
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
List information: https://www.gnu.org/software/emacs/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to='jogt0c$2qb$1@dough.gmane.org' \
--to=jeberger@free.fr \
--cc=help-gnu-emacs@gnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).