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

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux