04-09-2008, 10:02 AM
|
#1 (permalink)
|
|
The Contributor
Join Date: Jan 2008
Location: Leeds
Posts: 52
Thanks: 7
|
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!
|
|
|