Mega Code Archive

 
Categories / Perl / Regular Expression
 

A greedy quantifier

$string="this is a test. this is another test"; $string =~ s/is.*/is not/; print "$string\n"; # Turning off greed $string="this is a test. this is another test"; $string =~ s/is.*?/is not/; print "$string\n";