The Regular expression (<p[^>]*>*?<\/p>)(*SKIP)(*F)|<p[^>]*>.*?<\/h\d+> helped match the needful, that is, it matched line 2 and then line 3, separately
(<p[^>]*>*?<\/p>)(*SKIP)(*F)|<p[^>]*>.*?<\/h\d+>