m/]* # an anchor tag href= # the Href in the anchor (["'])((?:(?!\1).)*)\1 # the value in the href [^>]*> # anything to the end of the anchor [^<>]* # the content in the anchor tag <\/a> # the end of the anchor (?:\s|<[^>]*>)+ # any whitespace or html tags (\d{9}) # the 9 digit number /isxm; my $href = $2; my $number = $3; #### my $re = qr/]* # an anchor tag href= # the Href in the anchor (["'])((?:(?!\1).)*)\1 # the value in the href [^>]*> # anything to the end of the anchor [^<>]* # the content in the anchor tag <\/a> # the end of the anchor (?:\s|<[^>]*>)+ # any whitespace or html tags (\d{9}) # the 9 digit number /isxm; my $string = do{local $/; }; while($string =~ m/$re/g){ my $href = $2; my $number = $3; print "$number - $href\n"; } __DATA__

A

Abbott, Evelyn
110136892
Agnew, Thomas
110377660
Allison, David
108116112
Allison, Gary Owen
116815754
Arsenault, Michael
108318866
Arsenault, Normand A.
113069066
##
## 110136892 - pdf\c76b834e-36e1-497b-b13e-eba2348dc04 +4.pdf 110377660 - pdf\8a956f66-1c60-48fc-905c-b49d617aa6c5.pdf 108116112 - pdf\37d3e78b-1adb-458b-9e89-0df78 +0909f08.pdf 116815754 - pdf\6c0a5bb4-143d-4305-957b-796c8193d07a.pdf 108318866 - pdf\ae8d51e0-005b-44be-84cb-3c9b5733575 +5.pdf 113069066 - pdf\e646f948-f78d-4463-a01d-0261aebf70dc.pdf