php regex: removing more than double space

后端 未结 2 416
长发绾君心
长发绾君心 2021-01-23 15:26
$tags = preg_replace(\'/\\s\\s+/\',\' \', $tags);

that will remove more than just one space ?

i need to remove anything more than double space.

2条回答
  •  小蘑菇
    小蘑菇 (楼主)
    2021-01-23 15:53

    So you want to replace a sequence of 2 or more spaces with a single space? What you've got there is pretty much it, except that it will match any whitespace (tabs, etc) not just spaces.

提交回复
热议问题