$s = "goodwood";
$s =~ s/o*/e/;
print "$s \n";
# got - 'egoodwood'
It really stuck me - since there is no match, why the 'e' got prefixed into the string? I understand that o* - can match nothing or more, but should the * quantifier be greedy and match the 'oo' in the good? Thanks.In reply to Regex - substitute by Anonymous Monk
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |