Did you even bother to read the question? Text::Balanced parses strings with nested paired delimiters. Apart from the fact that it has “balanced” in its name, it has nothing to do with the OP’s problem.
What baffles me even more is that >20 people upvoted this vacuous suggestion, for whatever reason.
Makeshifts last the longest.
In reply to Re^2: Ensuring HTML is "balanced"
by Aristotle
in thread Ensuring HTML is "balanced"
by skx
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |