0
A
回答
1
// Use {4,} to indicate 4 or more of the preceding thing
$pattern = '~\?{4,}~';
$str = "I have 3??? and that isn't enough";
$str2 = "I have 5????? and that is enough";
// Won't replace only 3 ?
echo preg_replace($pattern, '', $str);
// I have 3??? and that isn't enough
// Will replace 5 ?
echo preg_replace($pattern, '', $str2);
// I have 5 and that is enough
相關問題
- 1. preg_replace刪除多個\ n
- 2. preg_replace刪除@
- 3. 正則表達式來刪除所有雙(或更多)的來信 - >的preg_replace
- 4. php preg_replace兩個或更多的空格
- 5. preg_replace刪除參數變量
- 6. preg_replace與多個值
- 7. 只刪除或只更新或更新+刪除mysql
- 8. preg_replace與preg_quote除了一列
- 9. Preg_replace或JavaScript .remove刪除wordpress網站中的元素?
- 10. 的preg_replace - 更換出現3次或更多次
- 11. 的preg_replace還會刪除時只問了空間被刪除
- 12. 如何使用preg_replace刪除字符串?
- 13. 刪除img標籤和使用的preg_replace
- 14. 刪除第一個換行preg_replace
- 15. 的preg_replace刪除HTTP:從鏈接
- 16. 刪除列W使用的preg_replace
- 17. 在preg_replace函數期間刪除字符
- 18. 的preg_replace不刪除自定義標籤
- 19. preg_replace從字符串中刪除'
- 20. 的preg_replace:只在花backets刪除評論
- 21. 使用preg_replace函數刪除字符
- 22. preg_replace函數刪除IE評論
- 23. 使用Preg_Replace保留刪除的值
- 24. 如何刪除整個DIV用了preg_replace
- 25. 刪除URL中的空格和preg_replace
- 26. 使用Preg_replace刪除中文字符?
- 27. preg_replace:如何不刪除整個部分?
- 28. preg_replace刪除文本和標籤
- 29. 使用preg_replace刪除html標記
- 30. preg_replace函數刪除HTML標籤問題
如果你想保留一個問號,用'「?」'而不是'「」'替換模式。 –
它工作正常:) – Spacedust