删除PHP中的圆括号之间的所有内容?
问题描述:
I want to remove round brackets and anything between them. Which RE i used ? I used below code but some some language like Hindi it's not work some time. Please any one help me.
nl2br(preg_replace("/\([^)]+\)/","",$main_ary[$y]." "));
//Ex. एंड्रॉयड 4.4.2 (किटकैट) ऑपरेटिंग सिस्टम पर
//I want एंड्रॉयड 4.4.2 ऑपरेटिंग सिस्टम पर
我想删除圆括号及其间的任何内容。 我用过哪个RE? 我使用下面的代码,但有一些语言像印地语,它不是一段时间的工作。 请任何人帮助我。 p>
nl2br(preg_replace(“/ \([^]] + \)/”,“”,$ main_ary [$ y]。“” ));
//例 एंड्रॉयड4.4.2(किटकैट)फपरेटिंगसिस्टमपर
//我想要एंड्रॉयड4.4.2पपरेटिंगसिस्टमपर
code> pre>
div>
答
You can use lazy selection (.*?
) to skip all sorts of characters until the first occurrence of the next character in the regular expression ()
) is reached.
preg_replace("/\(.*?\)/","",$main_ary[$y]." ")