【发布时间】:2015-09-23 04:52:30
【问题描述】:
我目前有一个 preg_match_all 用于不包含空格的常规字符串,但我现在需要使其适用于每个空格之间的任何内容。
我需要abc, hh, hey there, 1 2 3, hey_there_ 才能返回
abchhhey there``1 2 3hey_there_
但我当前的脚本会在涉及空格时停止。
preg_match_all("/([a-zA-Z0-9_-]+)+[,]/",$threadpolloptions,$polloptions);
foreach(array_unique($polloptions[1]) as $option) {
$test .= $option.' > ';
}
【问题讨论】:
-
为什么不直接用
\s*,\s*分割 -
你能发布例子吗?不太擅长这个功能。
标签: php regex preg-match preg-match-all