如果我有像這樣的字符串"location":"Denton TX"
(包括雙引號) 我只想得到Denton TX
。我怎樣才能爲那件事寫正則表達式?正則表達式混淆
我試圖
function getInfo($info,$content){
echo 'getting INFO';
preg_match_all("\.".$info."\.:\"[^\"]*(.*?)\.,",$content,$matches,PREG_PATTERN_ORDER);
print_r($matches);
return $matches[0];
}
,我把 '位置' 爲$info
,但它不工作。
你有任何錯誤,如需要[分隔符](http://www.php.net/manual/en/regexp.reference.delimiters.php)? – Wiseguy
沒有沒有得到任何錯誤T___T –
其次是缺少分隔符作爲問題。另外,http://www.whathaveyoutried.com/ – Adrian