The previous regex was incorrect and caused false-positive matches. One such case was a `<td>The …</td>` which translated into `###td ###The …`, causing it to be recognized as a `<th>`.
The new regex is much more restrictive by requiring at least one whitespace after the tag name if there is additional content.
for (var i = 0; i < len; i++) {
if (tags[i] === 'td' || tags[i] === 'th') {
html = html.replace(
- new RegExp('###' + tags[i] + '\s?(.*?[^#])###', 'gi'),
+ new RegExp('###' + tags[i] + '(?:\\s?|\\s([^#]*?))###', 'gi'),
'<' + tags[i] + '$1>'
);
}