Help for this page

Select Code to Download


  1. or download this
    /^([01])[01]*$/
    
  2. or download this
    /^(?=(.))[01]+$/
    
  3. or download this
    /^(?=[01]+$)(.)/
    
  4. or download this
    use Benchmark 'cmpthese';
    cmpthese(-3, {
    ...
       capture_in_lookahead => sub { my $x; ($x) = /^(?=(.))[01]+$/ foreac
    +h qw(0 1 00 11 10 01 000x00) },
       lookahead_then_capture => sub { my $x; ($x) = /^(?=[01]+$)(.)/ fore
    +ach qw(0 1 00 11 10 01 000x00) },
    });
    
  5. or download this
    Benchmark: running capture_in_lookahead, lookahead_then_capture, plain
    +, each for at least 3 CPU seconds...
    capture_in_lookahead:  3 wallclock secs ( 3.41 usr +  0.00 sys =  3.41
    + CPU) @ 24781.52/s (n=84505)
    ...
    lookahead_then_capture 24592/s                     --                 
    + -1%   -2%
    capture_in_lookahead   24782/s                     1%                 
    +  --   -1%
    plain                  24989/s                     2%                 
    +  1%    --