我想使用正则表达式来摆脱特定字符之间的字符串,例如“[”和“]”:删除文本
input = "There is a [blue] cloud on top of that [big] elephant";
desiredOut = "There is a cloud on top of that elephant"; // this is what i want
但是,如果使用正则表达式更换什么是“[”和“]”我删除了第一个和最后这个人物之间的一切之间:
string input = "There is a [blue] cloud on top of that [big] elephant";
string regex = "(\\[.*\\])" ;
string actualOut = Regex.Replace(input, regex, "");
actualOut = "There is a elephant" // this is what i get
如何卸下inmediate分隔符之间的东西任何线索?谢谢。
谢谢你!那就是诀窍。 – Santi 2015-04-05 12:29:29