[英]How can I replace a block of code in a php file using preg_replace and regex expression?
[英]In PHP how can i OR two regex in preg_replace?
我想知道在PHP中能否在preg_replace中將以下兩個正則表達式組合在一起? 如果是的話,請解釋我,這可能使您成為現實。
// I want to make it one line code
$plaintext = preg_replace('/\(.*?\)/u', "", $plaintext);
$plaintext = preg_replace("/\([^)]+\)/u", "", $plaintext);
//Output like
$plaintext = preg_replace('/\(.*?\)/u' | "/\([^)]+\)/u", "", $plaintext);
像這樣嗎
$plaintext = preg_replace("/(\(.*?\))|(\([^)]+\))/u", "", $plaintext);
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.