I had a tough time reproducing it in Perl, although I think I managed to get it.
% perl -v
This is perl 5, version 18, subversion 2 (v5.18.2) built for x86_64-linux-gnu-thread-multi
% ls -l testfile
125380092 Jul 20 16:41 testfile
% time ./regextest testfile
./regextest testfile 0.36s user 0.03s system 99% cpu 0.398 total
(Remove the a at the end)
% time ./regextest testfile
./regextest testfile 0.13s user 0.03s system 99% cpu 0.156 total
I had to make a much larger input file than I expected before I was able to really see the difference. Given the O(n^2) nature of the bug, I was expecting it to take much longer.