Duncan - you are a true star!
Just to make it more interesting, here's another tweak:
If the \n IS preceeded by 'table>', 'tr>' or 'td>' then, instead of just leaving it as a \n character, it would be better to replace it with a pseudo linefeed - say a string such as '{n}' If I leave the...