As I understood the problem, the goal was not necessarily to detect wrong or illegal HTML, but to make sure the output was valid so that posts further down the page are not screwed up. I never suggested that the input be assumed to be valid; in fact the way I built my suggested solution was to detect valid anchors and to render everything else as text (with entities). I feel that my suggestion, while not complete, at least lends itself to being able to prevent user mistakes or ignorance from affecting other posts.
Oh, and when I mentioned nesting, I meant that the comment inside the anchor element would be treated by my regex like nesting. I know that what you wrote was in fact an example of a legal comment inside a single A element, but since there is no reason for a user to comment the code in a BBS post I felt the mangling of that was an acceptable loss.
In reply to Re^6: RegEx for incorrectly closed HTML attribute?
by LAI
in thread RegEx for incorrectly closed HTML attribute?
by Cody Pendant
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |