Regex teaser

Yitzchak Scott-Thoennes sthoenna at gmail.com
Wed Dec 4 00:34:28 GMT 2013


On Tue, Dec 3, 2013 at 3:54 PM, Paul Makepeace <paulm at paulm.com> wrote:
> What does this output?
>
> $ perl -le '($a = "aabbb") =~ s/b*$/c/g; print $a'
>
> Cunning multilinguists may also answer the same question of these,
> (which nominally do the same thing)
>
> $ ruby -e 'p "aabbb".gsub(/b*$/, "c")'
>
> $ python -c "import re; print re.sub(r'b*$', 'c', 'aabbb')"

Nominally?  python 2.7.4 didn't for me.


More information about the london.pm mailing list