日期:2014-05-18  浏览次数:20859 次

用过Regex.IsMatch的进
我在C#中用正则表达式,用测试工具测过表达式正确,但不知道为什么在C#中用Regex.IsMatch却总得不到TRUE,
请帮我看看为什么
string ary = "111";
if (Regex.IsMatch(ary, "[0-9]{3}"))
{
....................
}

------解决方案--------------------
我测试过没问题啊。
C# code
string ary = "111";
Console.Write(Regex.IsMatch(ary, "[0-9]{3}")); //True

------解决方案--------------------
C# code
Regex x=new Regex("[0-9]{3}"); 
string s="111";
if(x.IsMatch(s))
{
MessageBox.Show("true");
}