简单的正则表达式
一个字符ID=[txtID.TEXT] AND NAME=[txtName.Text] AND Status='Y'
把中括号里面的提取出来。
[txtID.TEXT]
[txtName.Text] --------------------编程问答--------------------
string s = "ID=[txtID.TEXT] AND NAME=[txtName.Text] AND Status='Y'";
MatchCollection matches = Regex.Matches(s, @"(?<=\[)[^]]+(?=\])");
foreach (Match match in matches)
Response.Write(match.Value + "<br/>");
输出:
txtID.TEXT
txtName.Text
--------------------编程问答--------------------
+1
补充:.NET技术 , C#