I want to remove with PHP question marks in excess or that do not belong to a question, like from this:
question? ???? ???
question???
to this: (keeping only one question mark )
question?
question?
this is my code:
$text = 'question? ???? ???
question???';
echo preg_replace("?", "", $text);
preg_replace('/\\?[? ]+/', '?', $text);
这将用单个问号替换问号后跟问号和空格的任意组合。
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.