繁体   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