View Single Post
Old 04-09-2008, 10:02 AM   #1 (permalink)
oMIKEo
The Contributor
 
oMIKEo's Avatar
 
Join Date: Jan 2008
Location: Leeds
Posts: 52
Thanks: 7
oMIKEo is on a distinguished road
Default preg_replace limit results

Hi,

I want to extract the value between [SiteName] from $postText and save it as $s_sitename. Is preg_replace the best way to do this?

Here is what i have so far:

PHP Code:
$pattern[0] = "/\[SiteName\](.*)\[\/SiteName\]/";
$replace[0] = "$1";
$s_sitename preg_replace($pattern$replace$postText); 
At the moment i get the sitename but it then shows all the other text in $postText.

Thanks!
Send a message via MSN to oMIKEo
oMIKEo is offline  
Reply With Quote