RegEx-如何摆脱这两个括号之间的一切,包括括号? [英] RegEx - How to get rid of everything between these two brackets, including the brackets?
本文介绍了RegEx-如何摆脱这两个括号之间的一切,包括括号?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我在编写正则表达式方面没有取得进展,需要一些帮助。
I am making NO headway in writing a regular expression and need some help.
我需要摆脱两个括号之间的所有内容,包括两个括号。
I need to get rid of everything between two brackets including the two brackets.
我已经尝试了所有我想不到的东西。
I have tried everything I could think of with no luck.
<cfscript>
MyString = "Eat some [pizza] with beer.";
MyString = reReplaceNoCase(MyString, "", "", "all");
writeOutput(MyString);
</cfscript>
在文本编辑器中,我使用了以下字符串,并且效果很好,但是我可以不能在ColdFusion中使用它。
In a text editor, I was using the following string and it worked perfectly well, but I can't get it working in ColdFusion.
^[*^]
你能帮我吗?
推荐答案
\[[^\]]*]
您必须逃脱括号否则它们将被解释为这些括号内的任何字符
You have to escape the brackets or they will be interpreted as "any character inside these brackets"
这篇关于RegEx-如何摆脱这两个括号之间的一切,包括括号?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文