Help for this page

Select Code to Download


  1. or download this
    my $s = 'ab';
    my $pat = qr/^(a{1,3})(?=b)/;
    ...
    {
        $s =~ s/$pat/$1a/g;
    }
    
  2. or download this
    my $s = 'ab';
    my $pat = qr/^(a{1,3})(?=b)/;
    
    do{ $s =~ s/$pat/$1a/g } while $s =~ m/$pat/;