常用正则表达式(收集中……)

1.判读是否为数字

System.Text.RegularExpressions.Regex reg1 = new System.Text.RegularExpressions.Regex(@"^[-]?\d+[.]?\d*$");

if(reg1.IsMatch(str))
{
//数字
}
else
{
//非数字
}
Top
收藏
关注
评论
原文地址:https://www.cnblogs.com/smiler/p/1778094.html