【发布时间】:2016-01-25 06:56:00
【问题描述】:
int characterLimit = 5;
Regex regxForAlpha = new Regex("^[a-zA-Z \n] {0,"+characterLimit.ToString()+"}+$");
if(!string.IsNullOrEmpty(e.NewTextValue))
if (!Regex.IsMatch( e.NewTextValue, regxForAlpha)){
}
else
{
}
此代码抛出 NestedQuantifier 异常。任何人都可以知道为什么吗?
【问题讨论】:
-
它是 {n,n} 之后的“+”。删除“+”喜欢这里:stackoverflow.com/questions/210206/…
-
如果我删除 + 它没有按预期工作。