Regex teaser
James Laver
james.laver at gmail.com
Wed Dec 4 00:59:44 GMT 2013
On 3 Dec 2013, at 23:54, Paul Makepeace <paulm at paulm.com> wrote:
> What does this output?
>
> $ perl -le '($a = "aabbb") =~ s/b*$/c/g; print $a’
You can tell you’ve been writing perl too long when you know what that’s going to do and why :(
Here’s your example modified to exhibit my favourite regex madness. Can you explain this one?
perl -le '($a = "aabbb") =~ s/.*?/./g; print $a’
James
More information about the london.pm
mailing list