代码语言:javascript复制
using System;
using System.Text.RegularExpressions;
public partial class _Default : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
string pattern = @"{LINKTECH|(S[^{}] )}";
string Test = "{BAIDU|xxxxx|yyyy}{LINKTECH|A2004|00000|123123}{GOOGLE|ddddd|ddd}";
Match mc = Regex.Match(Test, pattern, RegexOptions.IgnoreCase);
foreach (Group G in mc.Groups)
{
Response.Write(G.Value.ToString() "<br/>");
}
}
}
运行结果:
{LINKTECH|A2004|00000|123123}
A2004|00000|123123