in reply to Pulling all instances of a regex out

This is a little fragile, to say the least. But then again, regexp approaches to parsing always are.

use strict; use warnings; my $page = join '', <DATA>; my( @raw_groups ) = split /src\s*=\s*['"]/, $page; my( @images, @texts ); foreach my $raw ( @raw_groups ) { my( $image, $text ); next unless ( $image, $text ) = $raw =~ m/^ (http:.+?) # Capture the file URL ['"].+?> # Anchors (.+?) # Capture the text <\/td # Final anchor /isx; print "$image => $text\n"; push @images, $image; push @texts, $text; } __DATA__ </a><br><br><table width="100%" cellpadding="2" cellspacing="0" border +="0"><tr><td align="left" valign="bottom"><img src='http://images.tek +-tips.com/items/image001.gif' alt='Image001' width='40' height='40' b +order='0'> Description of image here</td><td align="right" valign="bo +ttom"></td> </tr><tr><td align="left" valign="bottom"><img src='http://images.tek- +tips.com/items/image002.gif' alt='Image002' width='40' height='40' bo +rder='0'> Description of image here</td><td align="right" valign="bot +tom"></td>

Dave