Regular Expression HTML tags

Posted by user134615 on Programmers See other posts from Programmers or by user134615
Published on 2014-06-04T21:30:53Z Indexed on 2014/06/04 21:41 UTC
Read the original article Hit count: 496

Filed under:
|

I'd like to know whether it exists a way to put the following HTML tags in a regex. What I want is a regex that can match all the start tags with their corresponding closing tags. E.g.,

Hello

There might be more tags inside. I had thought of something like this: ^<([a-z]+)([^<]+)(?:>(.)</\1>|\s+/>)$/, but it wont work. Sorry if this question doesnt belong to this section. Thank you.

© Programmers or respective owner

Related posts about html

Related posts about regular-expressions