{I apologize for the cross posting] References: ... <[EMAIL PROTECTED]> ... <[EMAIL PROTECTED]>
In-Reply-To: <[EMAIL PROTECTED]> [on Perl Beginners] Charles K. Clarkson wrote: > I'm curious. What prompted the question?
[ ... proof my implementation was invalid truncated.]
My corrected case: #! perl
use strict; use warnings;
$_ = "aaa"; print "no 'a' matched" unless /a/;
my $idx;
while (<DATA>) { ++$idx; print "Line $idx - seen $_" if /(?:)/; } __DATA__
Line 3
Line 5
Postfix uses PCRE for implementing Regular Expressions. Each PCRE is evaluated as if it is fresh - therefore there is no "previous" match to work from. Also, this is an empty string /^$/ (IE, only a NL or CR seen.)
As far as matching zero length, this is what I suggest: /(?:)/
The issue (short version): Comparing // and /^/
I said not good to use because // matches between characters:
a a a ^ ^ ^
And /^/ only matches the line beginning. I stated using /^/ was better as who really knows how // is implmented in PCRE -- then (here is where my statements went astray) I said in Perl // matches between characters.
Anyways, after being half wrong (still wrong over all) - this:
// and this: s///
are two independent cases in Perl. Good thing I don't take being wrong in a bad way :)
LOL, you were correct Dave :)
-- _Sx_ http://youve-reached-the.endoftheinternet.org/ _____ http://jaxpm.insecurity.org/ http://cis4dl.insecurity.org/
-- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] <http://learn.perl.org/> <http://learn.perl.org/first-response>