我需要在字符串中搜索模式。例如:
string big = "Hello there, I need information for ticket XYZ12345. I also submitted ticket ZYX54321. Please update.";
现在,我需要根据模式(XXX00000
即3个ALPHA而不是5个数字)提取/查找/搜索单词。
有什么办法吗?
对我来说,即使提取也可以。
请帮忙。
foreach (Match m in Regex.Matches(big, "([A-Za-z]{3}[0-9]{5})"))
{
if (m.Success)
{
m.Groups[1].Value // -- here is your match
}
}
本文收集自互联网,转载请注明来源。
如有侵权,请联系[email protected] 删除。
我来说两句