正则表达式过滤字符串,在特定规则的字符串中获取字符
string teststring = "fdsfdsfds[T:dd]fdfd[T:011edfdf0T]fdfdf";
Regex r = new Regex(@"\[T:([a-zA-Z_0-9]{1,})+\]");
MatchCollection ms = r.Matches(teststring);
foreach (Match m in ms)
{
string dd;
dd = m.Result("$1").ToString();
Response.Write(dd+"<br>");
}
浙公网安备 33010602011771号