我试图从我的字符串中删除一个以上的白色大字:正则表达式:删除白字
$content = preg_replace('/\s+/', " ", $content); //in some cases it doesn't work
,但是当我写
$content = preg_replace('/\s\s+/', " ", $content); //works fine
有人能解释一下为什么?
,因为当我写/\s+/
为什么它不工作,它必须匹配所有与一个或多个空白字符,?
感谢
给我们一个片段,重现此问题。要不然。 – polygenelubricants 2010-08-23 19:33:46
对不起,问题出在另一个地方。 我在将数据插入数据库时失去了价值。非常非常奇怪的行为,我会找到原因并更新问题。 – Simon 2010-08-23 20:02:16