string s = "dfasfdasfdsa*fdasfdsafdsa";
s = "转发:dfasfdasfdsa*fdasfdsafdsa";
//s = "转发:***dfasfdasfdsa*fdasfdsafdsa";
//s = "转发: dfasfdasfdsa*fdasfdsafdsa";
//s = "转发: * * * dfasfdasfdsa*fdasfdsafdsa"; MatchCollection mc = Regex.Matches(s, @"(转发:)*[\s|*]*(?<a>\S+)");
foreach (Match m in mc)
{
string s2 = m.Groups["a"].Value;
//s2 = dfasfdasfdsa*fdasfdsafdsa
}
分组中我们使用(?<a>\S+)表示一组