RegEx: h1 followed by h2 without p in between

Posted by voodoo555 on Stack Overflow See other posts from Stack Overflow or by voodoo555
Published on 2010-05-26T15:24:59Z Indexed on 2010/05/26 15:31 UTC
Read the original article Hit count: 314

Hey everyone,

I need a regular expression to find out whether or not a h1 tag is followed by a h2 tag, without any paragraph elements in between. I tried to use a negative lookahead but it doesn't work:

<h1(.+?)</h1>(\s|(?!<p))*<h2(.+?)</h2>

© Stack Overflow or respective owner

Related posts about html

Related posts about regex