我讨厌preg_match语法!
[file.txt的] 来源:
sth = s("Would you like to go to the cinema "+
"With me?");
}
else if (something)
{
sth = s("Would you like to go to the cinema "+
"With me?");
} else {
sth = s("Sure, no problem");
}
PHP:
$file = file_get_contents("file.txt");
$file = str_replace(PHP_EOL, '', $file);
preg_match_all("/s\(\"(.*) /", $file, $matches);
var_dump($matches);
这显示了太多的单词,因为我有"起点"没有结束的模式。但我不知道,我怎么能用这样的结尾分隔符创建preg:
preg_match("/ [s(" .... ")] /")
我想从源头抽奖:
"Would you like to go to the cinema With me?"
"Would you like to go to the cinema With me?"
"Sure, no problem"
请帮我创建模式。