[26535] in Perl-Users-Digest
Perl-Users Digest, Issue: 8682 Volume: 10
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Thu Nov 17 21:05:31 2005
Date: Thu, 17 Nov 2005 18:05:04 -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 Thu, 17 Nov 2005 Volume: 10 Number: 8682
Today's topics:
Re: /(foo|)/ vs /(foo)?/ <sdn.girths00869@zoemail.net>
Re: [OT] Google Groups: vote for Default quoting <cwilbur@chromatico.net>
Digest Administrivia (Last modified: 6 Apr 01) (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: Thu, 17 Nov 2005 19:21:16 -0600
From: "Eric J. Roode" <sdn.girths00869@zoemail.net>
Subject: Re: /(foo|)/ vs /(foo)?/
Message-Id: <Xns9711CF34654F0sdn.comcast@216.196.97.136>
-----BEGIN xxx SIGNED MESSAGE-----
Hash: SHA1
Abigail <abigail@abigail.nl> wrote in
news:slrndnpme2.qiv.abigail@alexandra.abigail.nl:
> $_ = "bar";
> print /(foo|) (?(1)|(?!))/x ? "match\n" : "no match\n";
> print /(foo)? (?(1)|(?!))/x ? "match\n" : "no match\n";
> __END__
> match
> no match
Abigail, the master weaver of perl regexes, has once again confounded
me. It ain't the first time. :-) I had never seen (?(...)). I
looked in "perldoc perlre", and it wasn't much help:
"(?(condition)yes-pattern|no-pattern)"
"(?(condition)yes-pattern)"
Conditional expression. "(condition)" should be either an
integer in parentheses (which is valid if the corresponding
pair of parentheses matched), or look-ahead/look-behind/eval-
uate zero-width assertion.
For example:
m{ ( \( )?
[^()]+
(?(1) \) )
}x
matches a chunk of non-parentheses, possibly included in
parentheses themselves.
This.... is vague at best. What is "no-pattern"? What means
"valid"? ("matches", I assume, but perhaps one should not use it if
there's a chance that the numbered parentheses don't match?) Must
the look-ahead/look-behind/evaluate match at that point? If so, how
is it any different than having the assertion at that point *not*
within (?(...))?
If anyone can explain, or point me to a better explanation than
perlre, I would be grateful.
- --
Eric
`$=`;$_=\%!;($_)=/(.)/;$==++$|;($.,$/,$,,$\,$",$;,$^,$#,$~,$*,$:,@%)=(
$!=~/(.)(.).(.)(.)(.)(.)..(.)(.)(.)..(.)......(.)/,$"),$=++;$.++;$.++;
$_++;$_++;($_,$\,$,)=($~.$"."$;$/$%[$?]$_$\$,$:$%[$?]",$"&$~,$#,);$,++
;$,++;$^|=$";`$_$\$,$/$:$;$~$*$%[$?]$.$~$*${#}$%[$?]$;$\$"$^$~$*.>&$=`
-----BEGIN xxx SIGNATURE-----
Version: GnuPG v1.2.5 (MingW32) - WinPT 0.7.96rc1
iD8DBQFDfSy1Y96i4h5M0egRAs0RAKCrawVLAl5CbY6NN8g1e2dLb6E0TQCfYhJN
yZukxNUWWVMPxSZRy3PlmJ4=
=NKDG
-----END PGP SIGNATURE-----
------------------------------
Date: Thu, 17 Nov 2005 19:13:02 -0500
From: Charlton Wilbur <cwilbur@chromatico.net>
Subject: Re: [OT] Google Groups: vote for Default quoting
Message-Id: <m2u0eau835.fsf@ubiquity.chromatico.net>
>>>>> "JB" == John Bokma <john@castleamber.com> writes:
JB> Which exclude people working for a company that just firewalls
JB> some ports, or if your Usenet server is down, and you have an
JB> urgent post to make. (Been there).
Not my problem, frankly; they can get their work and their servers to
behave sensibly, or they can cope with me not reading their posts.
The only policies that dictate how I spend my time are those of my
workplace, which compensates me for the inconvenience with money.
If the Google Groups users were to compensate me for my time at a
similar hourly rate, however, I would be pleased to remove the block.
Charlton
--
cwilbur at chromatico dot net
cwilbur at mac dot com
------------------------------
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 8682
***************************************