繁体   English   中英

其中的括号和字符串的正则表达式

[英]regular expression for brackets and strings inside it

I am looking for a JavaScript regular expression that allow me to remove any text in brackets and include the brackets itself.

Example:

"hello world ( some Text and Number here)" 

And I want to trim ( some Text and Number here) and get the result as:

"hello world"

您是否尝试过以下一种方法:

\(.*?\)

实际的js可能像dis:

var a = "hello world ( someText and Number here)";
a = a.replace(/\(.*?\)/, "");

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM