On Wednesday, Sep 22, 2004, at 08:05 US/Central, Jenda Krynicky wrote:
Which means it's actually much easier than I had you believe:
$s = "sasas dfgfgh asasas asedsase"; while ($s =~ /(?=sas)/g) { print "pos=",pos($s), " = '",substr($s,pos($s),3),"'\n"; }
Based on your example, I was able to transform this:
$ perl -e '$foo="baaaab"; $re="aa" ;
for ($bar=index($foo, $re); $bar >= 0 ; $bar=index($foo, $re, $bar+1))
{ print $bar, "\t" }
print "\n" ; '
into this:
$ perl -e '$foo="baaaab"; $re=qr/(?=aa)/ ; while($foo =~ /$re/g) { print pos($foo), "\t" } print "\n" ; '
Works exactly as I had hoped, and I understand this one.
Will study your other examples with \G. I still don't understand those. Will probably just take a little time and experimenting.
Thanks for your help.
Regards, - Robert OpenSource for Windows, Linux, and Mac OS/X http://www.cwelug.org/downloads
-- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] <http://learn.perl.org/> <http://learn.perl.org/first-response>