Regular expression is an unstressed HTML tag

Does anyone have a regular expression to match unclosed HTML tags? For example, the regular expression will match the . and the second , but not the first or first closing tag:

testing

Is this too complicated for regular expressions? May need some recursive programmatic processing?

I’m sure some regex masters can piece something together, this may be a Something similar to the solution, but this is a bad idea: HTML isn’t regular. Consider an HTML parser that can recognize these problems, or parse it yourself.

Someone has a regular Expression to match unclosed HTML tags? For example, the regular expression will match the . and the second , but not the first or first closing tag:

testing

Is this too complicated for regular expressions? May need some recursive programmatic processing?

I’m sure some regex masters can piece something together, this may be something similar to the solution, but it is a bad Idea: HTML isn’t regular. Consider an HTML parser that can recognize these problems, or parse it yourself.

Leave a Comment

Your email address will not be published.