1            string s = "dfasfdasfdsa*fdasfdsafdsa";
 2             s = "转发:dfasfdasfdsa*fdasfdsafdsa";
 3             //s = "转发:***dfasfdasfdsa*fdasfdsafdsa";
 4             //s = "转发: dfasfdasfdsa*fdasfdsafdsa";
 5             //s = "转发: * * * dfasfdasfdsa*fdasfdsafdsa";
 6 
 7             MatchCollection mc = Regex.Matches(s, @"(转发:)*[\s|*]*(?<a>\S+)");
 8             foreach (Match m in mc)
 9             {
10                 string s2 = m.Groups["a"].Value;
11                 //s2 = dfasfdasfdsa*fdasfdsafdsa
12             }     

分组中我们使用(?<a>\S+)表示一组

相关文章:

  • 2021-06-27
  • 2021-11-04
  • 2021-06-24
  • 2022-12-23
  • 2022-12-23
猜你喜欢
  • 2022-12-23
  • 2021-11-03
  • 2021-08-12
  • 2021-05-13
  • 2021-09-09
  • 2022-12-23
  • 2021-08-09
相关资源
相似解决方案