[27266] in Perl-Users-Digest

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

Perl-Users Digest, Issue: 9028 Volume: 10

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Wed Mar 8 03:05:45 2006

Date: Wed, 8 Mar 2006 00:05:05 -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           Wed, 8 Mar 2006     Volume: 10 Number: 9028

Today's topics:
    Re: Regex: Backreferences do not work inside quantifier <tadmc@augustmail.com>
    Re: Regex: Backreferences do not work inside quantifier <someone@example.com>
        Ronald Matthews <josef.moellers@fujitsu-siemens.com>
        Digest Administrivia (Last modified: 6 Apr 01) (Perl-Users-Digest Admin)

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

Date: Tue, 7 Mar 2006 19:40:21 -0600
From: Tad McClellan <tadmc@augustmail.com>
Subject: Re: Regex: Backreferences do not work inside quantifiers?
Message-Id: <slrne0sdg5.1oi.tadmc@magna.augustmail.com>

Ilya Zakharevich <nospam-abuse@ilyaz.org> wrote:
> [A complimentary Cc of this posting was sent to
> Wolfgang Thomas 
><usenet@nana.franken.de>], who wrote in article <dukl07$lhr$01$1@news.t-online.com>:
>> $s =~ /([\d]+):(.{\1})/;
> 
> This should match, e.g.,
> 
>   123:a{123}
> 
> "{" is special in REx only in very few of contexts.


Aha!

So it is only incompletely documented (from perlre.pod):

   The following standard quantifiers are recognized:

       *      Match 0 or more times
       +      Match 1 or more times
       ?      Match 1 or 0 times
       {n}    Match exactly n times
       {n,}   Match at least n times
       {n,m}  Match at least n but not more than m times

   (If a curly bracket occurs in any other context, it is treated
   as a regular character.) 

Looks like the OP's use of curly was in one of those "other" contexts...


-- 
    Tad McClellan                          SGML consulting
    tadmc@augustmail.com                   Perl programming
    Fort Worth, Texas


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

Date: Wed, 08 Mar 2006 07:00:17 GMT
From: "John W. Krahn" <someone@example.com>
Subject: Re: Regex: Backreferences do not work inside quantifiers?
Message-Id: <5ivPf.12954$Cp4.8841@edtnps90>

Wolfgang Thomas wrote:
> I have a line of the following format:
> string length followed by colon followed by the actual
> string.
> To extract the string with the correct length I use the
> following regular expression:
> 
> my $s = "3:abcd";
> $s =~ /([\d]+):(.{\1})/;
> print "$1\n";
> print "$2\n";
> 
> 
> However this does not match. Neither $1 nor $2 become
> defined. If I replace \1 with 3 it works as expected,
> I get 3 in $1 and "abc" in $2.

If you didn't have that colon in the way you could use unpack():

$ perl -le'
my $s = "3:abcd";
print unpack "A/A*", $s;
'
:ab



John
-- 
use Perl;
program
fulfillment


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

Date: Wed, 08 Mar 2006 08:54:31 +0100
From: Josef Moellers <josef.moellers@fujitsu-siemens.com>
Subject: Ronald Matthews
Message-Id: <dum2nl$im7$1@nntp.fujitsu-siemens.com>

For the information of those feeling annoyed by this person.

I received a PM today of a person who shared the following information=20
with me:

----------------------------------------------------------------------
I've only been reading comp.lang.perl.misc for a few days now, but it
seems to me that rlm is new there also. I used to read the cesspit
that is rec.sport.baseball. For a hint as to what this guy is like,
try googling rec.sport.baseball & author "realto margarino" or "Roger
mother". (He posted as Roger Lustig's Mother, but google doesn't like
that, for some reason).

He is still posting to rsbb, merrily defecating directly on people's
faces all the day. Seriously, this guy is a nut case. What he's now
doing in clpm, he's been doing in rsbb for at least 10 years. I
haven't been reading the group long enough to decide whetheror not to
post this info, so I picked you pretty much at random to let you
decide what to post.
----------------------------------------------------------------------

I have not yet found out why the people at rsbb have put of with this=20
person for 10 years.

I'd like to encourage everyone who feels annoyed about this person to=20
send an abuse complaint to the address in this person's message headers. =

Let symtpatico decide how to handle this and let's hope for the best.

And ... please ignore him.

Josef
--=20
Josef M=F6llers (Pinguinpfleger bei FSC)
	If failure had no penalty success would not be a prize
						-- T.  Pratchett



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

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:

#The Perl-Users Digest is a retransmission of the USENET newsgroup
#comp.lang.perl.misc.  For subscription or unsubscription requests, send
#the single line:
#
#	subscribe perl-users
#or:
#	unsubscribe perl-users
#
#to almanac@ruby.oce.orst.edu.  

NOTE: due to the current flood of worm email banging on ruby, the smtp
server on ruby has been shut off until further notice. 

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

#To request back copies (available for a week or so), send your request
#to almanac@ruby.oce.orst.edu with the command "send perl-users x.y",
#where x is the volume number and y is the issue number.

#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 V10 Issue 9028
***************************************


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