Hey vladkrack, thanks. That does it pretty nicely too.
I've found that doing this with a stream editor though sometimes returns the path and appears to struggle with long and funky filenames. The output can do this in places:
Of course this has nothing to do with the efficiency of your regex but the shoddy quality of the htmltags.txt files which was put together by end users who <b> think <u> nothing </b> of </u> nesting tags and using narratives instead of file naming conventions.jpg!
The advantage of doing it with perl is that it uses a built-in HTML parser (which is almost certainly cheating ...)