Re: Rather complex regular expression for the preg_match_all function

From: Date: Thu, 23 Jan 2003 20:01:29 +0000
Subject: Re: Rather complex regular expression for the preg_match_all function
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-132887@lists.php.net to get a copy of this message
Hi, it would be MUCH faster and easier to debug if you wrote a parser. See the example parsers in phpDocumentor, download available at http://www.phpdoc.org Greg "Andreas Sheriff" <mailinglist@asheriff.com> wrote in message news:000701c2c272$6b13b870$0f01a8c0@iion.com... > 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 (#132887) next »