Code: Select all
$search_string = 'Two years in, the company has expanded to 35 cities, five of which are outside the U.S. Plus, in April, [url=site.com]ClassPass[/url] acquired its main competitor, Fitmob.';
< /code>
$pattern
Code: Select all
$subject = "text text text text text". $search_string . "text text text text text";
< /code>
Using A regular expression to exclude a word/string, I've tried:
$pattern = '`^/(?!\ )'.$search_string.'`';
$output = preg_replace($pattern, $replacement_string,$subject);
< /code>
The end result will be that if the $subject does contains a string that is like my $seach_string
Bearbeiten:
Die tatsächlichen Werte:
Die tatsächlichen Werte:
Code: Select all
$subject = file_get_contents("http://venturebeat.com/2015/11/10/sources-classpass-raises-30-million-from-google-ventures-and-others/");
$search_string = "Two years in, the company has expanded to 35 cities, five of which are outside the U.S. Plus, in April, ClassPass acquired its main competitor, Fitmob.";
$replacement_string = "Two years in, the company has expanded to 35 cities, five of which are outside the U.S. Plus, in April, ClassPass acquired its main competitor, Fitmob.";