RE: replacement

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

 



[snip]
I'm trying to replace a substr of the string that start from "Rated
blahblah;" azt the end semicolon.

Example:
safsagfasdfsdfdsfRated by 4 people;fafafaafafaf -> return
safsagfasdfsdfdsffafafaafafaf

$replacement =""; 
$pattern = "/Rated.+;/"; 
$found_str = preg_replace($pattern, $replacement, $found_str);

Why this above, doesn't work?
[/snip]

What does it return? Try this ...

$string = "safsagfasdfsdfdsfRated by 4 people;fafafaafafaf";

$replacement ="";
$pattern = "/Rated.+;/";
$found_str = preg_replace($pattern, $replacement, $string);

echo $found_str;

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