in reply to regex hangs forever

It is highly encouraged to reduce your code to a simple test case that demonstrates the problem. Not just so there is less for us to read through, but also to help your solve you problem beforehand and reduce red herrings. If you had run a simple test case, as I illustrate below, you would have found that your test data and regex work just fine. So you need to look for something besides the regex.

Try running the code through the perl debugger perl -d to see where it really gets stuck at.

use strict; use warnings; use Data::Dumper; my @images; my $content = '<a href="http://www.imagebeaver.com/view.php?mode=galle +ry&g=115564&photo=1" target="_blank"><img src="http://www.imagebeaver +.com/files/images/thumb/37021412066526319.jpg" border="0"></a> <a hre +f="http://www.imagebeaver.com/view.php?mode=gallery&g=115564&photo=2" + target="_blank"><img src="http://www.imagebeaver.com/files/images/th +umb/99821412066526320.jpg" border="0"></a> <a href="http://www.imageb +eaver.com/view.php?mode=gallery&g=115564&photo=3" target="_blank"><im +g src="http://www.imagebeaver.com/files/images/thumb/6234141206652632 +1.jpg" border="0"></a> <a href="http://www.imagebeaver.com/view.php?m +ode=gallery&g=115564&photo=4" target="_blank"><img src="http://www.im +agebeaver.com/files/images/thumb/33641412066526322.jpg" border="0"></ +a> <a href="http://www.imagebeaver.com/view.php?mode=gallery&g=115564 +&photo=5" target="_blank"><img src="http://www.imagebeaver.com/files/ +images/thumb/5361412066526323.jpg" border="0"></a> <a '; push(@images, "http://www.imagebeaver.com/files/images/$1:$1") while $ +content =~ m#/files/images/thumb/([a-zA-Z0-9]+\.jpg)#g; print Dumper \@images;

grep
1)Gain XP 2)??? 3)Profit