Need help with a regex
| From: | Adam Zey | Date: | Sun, 21 Sep 2003 17:06:31 +0000 |
| Subject: | Need help with a regex | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-163359@lists.php.net to get a copy of this message | ||
I'm using the following regex:
/<tr><td class='newsitemtitle-td'>([^<]*)<\/td><td
class='newsitemposter-td'><span
class=([^>]*)>([^<]*)<\/span>([^<]*)<\/td><\/tr> <tr><td
class='newsitemcontent-td' colspan=2>([^<]*)<\/td><\/tr>/
Everything works well, except I've ran into one problem. In the last text
field, the bulk of the newsitem, sometimes the poster includes some HTML
tags (Like "<br \>", but others could be inserted). What I need to do is
modify that last submatch "([^<]*)" so that instead of matching until it
reaches a "<" (It catches on the br tag and ruins the match), it will match
until it reaches the entire <\/td> tag. Can somebody help me out with this?
I'm completely stumped about how to go about doing a "match until string" as
opposed to a "match until character".
Regards, Adam.
---
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.520 / Virus Database: 318 - Release Date: 18/09/2003