RE: [PHP] replacement
| From: | Jay Blanchard | Date: | Tue, 25 Jan 2005 21:03:39 +0000 |
| Subject: | RE: [PHP] replacement | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-207295@lists.php.net to get a copy of this message | ||
[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;