result = subject.match(/<\s*(\w+\b)(?:(?!<\s*\/\s*\1\b)[\s\S])*<\s*\/\s*\1\s*>|\S+/g);
будет работать, если ваши теги не могут быть вложенными, если все теги правильно закрыты, и если текущие имена тегов не встречаются в комментариях, строках и т. Д.
Пояснение:
<\s* # Either match a < (+ optional whitespace)
(\w+\b) # tag name
(?: # Then match...
(?! # (as long as it's impossible to match...
<\s*\/\s*\1\b # the closing tag here
) # End of negative lookahead)
[\s\S] # ...any character
)* # zero or more times.
<\s*\/\s*\1\s*> # Then match the closing tag.
| # OR:
\S+ # Match a run of non-whitespace characters.