RE: help with preg_match

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

 




-----Original Message-----
From: Chris Purves [mailto:chris@xxxxxxxxxxxx] 
Sent: Sunday, June 03, 2012 8:26 PM
To: php-general General
Subject:  help with preg_match

Hello,

I am trying to use preg_match to match something from an html file. 
Within the html file is some text that looks like:

<span>Something, something end</span>

I know that the text ends 'end', but I don't know what the Something,
something is.  I am using preg_match as follows:

preg_match('/[^>]*end/',$curl_response,$matches);

I want to match 'end' and everything before it that is not '>'.

The problem appears to be with the '>'.  I have tried escaping (\>), but it
didn't make a difference.  The php script hangs when it tries to run this
function.


--
Chris Purves

"There's a time to think, and a time to act. And this, gentlemen, is no time
to think." - Sheriff Bud B. Boomer

--
PHP General Mailing List (http://www.php.net/) To unsubscribe, visit:
http://www.php.net/unsub.php
-------------------------------------------------------------------

You could try this

preg_match_all('/(<span[^<>]*>*)(.*)(</span[^<>]*>)/is',$curl_response,$matc
hes);
print_r($matches);



Rick


-- 
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