1
using
System;
2 using System.Text.RegularExpressions;
3
4 public partial class _Default : System.Web.UI.Page
5 {
6 protected void Page_Load(object sender, EventArgs e)
7 {
8
9 string pattern = @"{LINKTECH\|(\S[^{}]+)}";
10 string Test = "{BAIDU|xxxxx|yyyy}{LINKTECH|A2004|00000|123123}{GOOGLE|ddddd|ddd}";
11 Match mc = Regex.Match(Test, pattern, RegexOptions.IgnoreCase);
12
13 foreach (Group G in mc.Groups)
14 {
15 Response.Write(G.Value.ToString() + "<br/>");
16 }
17 }
18
19}
20
2 using System.Text.RegularExpressions;
3
4 public partial class _Default : System.Web.UI.Page
5 {
6 protected void Page_Load(object sender, EventArgs e)
7 {
8
9 string pattern = @"{LINKTECH\|(\S[^{}]+)}";
10 string Test = "{BAIDU|xxxxx|yyyy}{LINKTECH|A2004|00000|123123}{GOOGLE|ddddd|ddd}";
11 Match mc = Regex.Match(Test, pattern, RegexOptions.IgnoreCase);
12
13 foreach (Group G in mc.Groups)
14 {
15 Response.Write(G.Value.ToString() + "<br/>");
16 }
17 }
18
19}
20
运行结果:
{LINKTECH|A2004|00000|123123}
A2004|00000|123123