Select PHP 中字符串的特定元素

Select Specific Element of String In PHP

我不知道如何获取字符串中的特定单词。这是我的字符串:

$productList = "A, Two Way A(TA)-(BWY DL), B, Multispeed Network-(BA_G)";

我从 ExtJs 树面板上的复选框中得到了这个字符串。该字符串将被分解成这样:

Array(
[0]=>BWY DL
[1]=>BA_G
)

我用了explode,结果不对

Array ( 
[0] => A, Two Way A(TA 
[1] => 
[2] => BWY DL 
[3] => , B, Multispeed Network 
[4] => BA_G
[5] => 
) 

我希望有人能帮助我。谢谢

$productList = "A, Two Way A(TA)-(BWY DL), B, Multispeed Network-(BA_G)";

$patt = '/\-\(([A-z ]*)\)/'; // match all which starts from -( and ends with )

preg_match_all($patt, $productList, $match);

echo '<pre>';
print_r($match[1]);

我还不清楚你愿不愿意输出这个,你可以试试