C#正则表达式验证数字

C#正则表达式验证数字
static bool IsNumeric(string str) 
{  
   System.Text.RegularExpressions.Regex reg1 
       = new System.Text.RegularExpressions.Regex(@"^[-]?\d+[.]?\d*$");  
   return reg1.IsMatch(str); 
}

posted on 2008-11-30 09:28  摇光  阅读(3928)  评论(0编辑  收藏  举报

导航