我有以下
string currency = string.Empty;
Regex r = new Regex(@"~(\w*[a-zA-Z0-9$£~%]+)", RegexOptions.IgnoreCase | RegexOptions.Compiled);
for (Match m = r.Match(expression); m.Success; m = m.NextMatch())
{
currency = (m.Groups[1].Value);
break;
}
return currency;
Run Code Online (Sandbox Code Playgroud)
内涵是,在循环中的第一个匹配之后它应该破坏.
警告消息(无法访问的代码)发生 在循环的m = m.NextMatch().
怎么克服这个?
谢谢
| 归档时间: |
|
| 查看次数: |
647 次 |
| 最近记录: |