簡體   English   中英

在PHP中如何在preg_replace中使用兩個正則表達式?

[英]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.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM