Re: What's the regex for this...?

From: Date: Wed, 05 Jul 2006 00:07:01 +0000
Subject: Re: What's the regex for this...?
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-239130@lists.php.net to get a copy of this message
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> I want to set $this to "This is a statement."
What code do you have so far? if it's strictly between those tags, this should work: preg_match_all('%<span class="myclass">(.*?)</span>%isU', $text, $matches); $matches[1] will be an array with all matches. -- Postgresql & php tutorials http://www.designmagick.com/

« previous php.general (#239130) next »