Mega Code Archive
Categories
/
Perl
/
Regular Expression
Metacharacters that Turn off Greediness
# Greedy and not greedy $_="abcdefghijklmnopqrstuvwxyz"; s/[a-z]+/XXX/; print $_, "\n"; $_="abcdefghijklmnopqrstuvwxyz"; s/[a-z]+?/XXX/; print $_, "\n";