Re: What's the regex for this...?
| From: | Paul Novitski | Date: | Tue, 04 Jul 2006 23:59:52 +0000 |
| Subject: | Re: What's the regex for this...? | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-239129@lists.php.net to get a copy of this message | ||
At 04:50 PM 7/4/2006, Brian Dunning wrote:
I have the source of a web page stored in $here and I want to set $this to whatever appears between '<span class="myclass">' and '</ span>'. Example: $here contains (amid tons of other stuff): <span class="myclass">This is a statement.</span>If you can depend on the markup you provided, you can use:
$this = preg_replace("/<[^>]+>/", "", $here);
to replace any <tag> with nothing. The regular expression /<[^>]+>/ parses to <{one or more characters that aren't >}>
Paul