Beefy Boxes and Bandwidth Generously Provided by pair Networks
Just another Perl shrine
 
PerlMonks  

Re^5: What perl operations will consume C stack space?

by Corion (Pope)
on Feb 27, 2006 at 14:18 UTC ( #533024=note: print w/ replies, xml ) Need Help??


in reply to Re^4: What perl operations will consume C stack space?
in thread What perl operations will consume C stack space?

Your first factorisation(sp?) is valid - (ab*){32766} and (ab+|a){32766} are equivalent, as they will both match and not match exactly the same strings (modulo any deficiencies in the Perl interpreter). Your second factorization is not equivalent, as the first regex allows for backslashed items, which the second doesn't:

#!/usr/bin/perl -w use strict; my @regexen = ( qr/"((?:\\.|[^"])+)"/, qr/"([^"]+)"/, ); for (<DATA>) { for my $r (@regexen) { print "$_\t"; print "\t$r"; if (/$r/) { print "\tMatch\t($1)\n"; } else { print "\tNo match.\n"; }; }; }; __DATA__ "foo\"bar"


Comment on Re^5: What perl operations will consume C stack space?
Select or Download Code

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://533024]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others scrutinizing the Monastery: (8)
As of 2014-10-01 07:41 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    How do you remember the number of days in each month?











    Results (389 votes), past polls