Php 提取特殊字符前后的字符串部分
我需要在特殊字符前后提取并显示一些单词 例如,此文本:Anywords1 Anywords2–Anywords3 Anywords4(39948) 我需要显示(PHP): 任意词1任意词2 任意词3任意词4Php 提取特殊字符前后的字符串部分,php,Php,我需要在特殊字符前后提取并显示一些单词 例如,此文本:Anywords1 Anywords2–Anywords3 Anywords4(39948) 我需要显示(PHP): 任意词1任意词2 任意词3任意词4 非常感谢 按照您的示例,您可以使用: $re = '/([a-zA-Z ])+/m'; $str = 'Anywords Anywords – Anywords Anywords (39948)'; preg_match_all($re, $str, $matches, PREG_SET_
非常感谢 按照您的示例,您可以使用:
$re = '/([a-zA-Z ])+/m';
$str = 'Anywords Anywords – Anywords Anywords (39948)';
preg_match_all($re, $str, $matches, PREG_SET_ORDER, 0);
// Print the entire match result
var_dump($matches);
请你坐电梯去看看