我有串:分割字符串的preg_match
$productList="
Saluran Dua(Bothway)-(TAN007);
Speedy Password-(INET PASS);
Memo-(T-Memo);
7-pib r-10/10-(AM);
FBI (R/N/M)-(Rr/R(A));
";
我想要的結果是這樣的:
Array(
[0]=>TAN007
[1]=>INET PASS
[2]=>T-Memo
[3]=>AM
[4]=>Rr/R(A)
);
我用:
$separator = '/\-\(([A-z ]*)\)/';
preg_match_all($separator, $productList, $match);
$value=$match[1];
但結果:
Array(
[0]=>INET PASS
[1]=>AM
);
必須有錯誤的代碼,有人可以幫助嗎?
添加數字'0-9'和破折號'-'您的正則表達式 – 2015-01-21 07:34:53