Rather complex regular expression for the preg_match_all function

From: Date: Thu, 23 Jan 2003 00:00:19 +0000
Subject: Rather complex regular expression for the preg_match_all function
Groups: php.general 
Request: Send a blank email to php-general+get-132709@lists.php.net to get a copy of this message
Hi, I'm trying to construct a regular expression to find HTML open tags without closing tags up to another of the same HTML open tag or a closing tag of a different type that's no enclosed in the implied closing tag optional HTML tag (for example <p> doesn't require a closing tag. The closing tag is implied and so is its body). For example, the HTML snippet: <html><head><title>Test HTML</title></head> <body> <p><font>This tag is ok<br></font></p> <font><p>I want to find this p tag<br> and up to the next opening p tag<br> <b>test<br></b></font> <p>I want to find this one too </body> I don't want to find <p> tags with a complete structure. ex: <p>This is a &lt;p&gt; tag with a complete structure</p> Instead, I want to find the <p> tag with no closing tag, up to the next <p> tag or a closing tag of any type that doesn't have an opening tag after the initial <p> found (not including this orphaned closing tag) Andreas Sheriff

« previous php.general (#132709) next »