in reply to Regex not working
Your regex is failing to take account of the newline characters.
However, parsing HTML with a regex is a bad idea. You should look at using a real HTML parser.
See the Copyright notice on my home node.
Perl training courses