Help for this page

Select Code to Download


  1. or download this
    my $var = 'a111a222a333';
    $var =~ m/a(\d+)/g and print $1
    # prints '111'
    
  2. or download this
    $var =~ m/a(\d+)/g and print $1;
    #will now print '222' because the regex starts at
    ...
    # NO, doesn't print '333'
    # but '111' because pos($var) wat set to 0 and so
    # the regexp startsat positin 0 again