[32310] in Perl-Users-Digest

home help back first fref pref prev next nref lref last post

Perl-Users Digest, Issue: 3577 Volume: 11

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Tue Dec 27 06:09:17 2011

Date: Tue, 27 Dec 2011 03:09:02 -0800 (PST)
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)

Perl-Users Digest           Tue, 27 Dec 2011     Volume: 11 Number: 3577

Today's topics:
        regexp for matching a string with mandatory underscores <davidfilmer@davidfilmer.com>
    Re: regexp for matching a string with mandatory undersc <xecycle@gmail.com>
        Digest Administrivia (Last modified: 6 Apr 01) (Perl-Users-Digest Admin)

----------------------------------------------------------------------

Date: Tue, 27 Dec 2011 02:04:07 -0800 (PST)
From: David Filmer <davidfilmer@davidfilmer.com>
Subject: regexp for matching a string with mandatory underscores
Message-Id: <2151840d-7a2b-42c4-8c9d-5f03adf30948@s10g2000prs.googlegroups.com>

I want to be able to match the string foo1_bar2_baz3 as having
multiple underscore characters (with no intervening whitespace), but
not match foo1_bar2 which has only one underscore.  I want to ignore
one match, but not two or more.

This would be easy if \w did not ALSO match underscores.  But it
does.  There does not seem to be a character class for alphanumeric
ONLY.

How can I match continuous alphanumeric strings which contain more
than one underscore?

Thanks!


------------------------------

Date: Tue, 27 Dec 2011 18:59:32 +0800
From: XeCycle <xecycle@gmail.com>
Subject: Re: regexp for matching a string with mandatory underscores
Message-Id: <877h1ie0vf.fsf@gmail.com>

David Filmer <davidfilmer@davidfilmer.com> writes:

[...]

> How can I match continuous alphanumeric strings which contain more
> than one underscore?

\w*_(_|\w)*

-- 
Carl Lei (XeCycle)
Department of Physics, Shanghai Jiao Tong University
OpenPGP public key: 7795E591
Fingerprint: 1FB6 7F1F D45D F681 C845 27F7 8D71 8EC4 7795 E591


------------------------------

Date: 6 Apr 2001 21:33:47 GMT (Last modified)
From: Perl-Users-Request@ruby.oce.orst.edu (Perl-Users-Digest Admin) 
Subject: Digest Administrivia (Last modified: 6 Apr 01)
Message-Id: <null>


Administrivia:

To submit articles to comp.lang.perl.announce, send your article to
clpa@perl.com.

Back issues are available via anonymous ftp from
ftp://cil-www.oce.orst.edu/pub/perl/old-digests. 

#For other requests pertaining to the digest, send mail to
#perl-users-request@ruby.oce.orst.edu. Do not waste your time or mine
#sending perl questions to the -request address, I don't have time to
#answer them even if I did know the answer.


------------------------------
End of Perl-Users Digest V11 Issue 3577
***************************************


home help back first fref pref prev next nref lref last post