查找字符串中的每个正则表达式匹配 [英] Find each RegEx match in string
本文介绍了查找字符串中的每个正则表达式匹配的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
ID喜欢做这样的事情。
id like to do something like
foreach (Match match in regex)
{
MessageBox.Show(match.ToString());
}
任何帮助的感谢...!
Thanks for any help...!
推荐答案
有一个的 RegEx.Matches
方式:
There is a RegEx.Matches
method:
foreach (Match match in regex.Matches(myStringToMatch))
{
MessageBox.Show(match.Value);
}
要获得匹配的子字符串,使用的 Match.Value
属性,如图所示以上。
To get the matched substring, use the Match.Value
property, as shown above.
这篇关于查找字符串中的每个正则表达式匹配的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文