1using System;
2using System.Text.RegularExpressions;
3
4public 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
时间: 2024-10-24 10:36:14