日期:2014-05-17 浏览次数:20536 次
protected void Button1_Click(object sender, EventArgs e)
{
string str=TextBox1.Text;
string pattern = @"(?is)^(-?0+|0+)(\.\d{1,6})$";
Regex reg = new Regex(pattern);
bool isValid = reg.IsMatch(str);
}
------解决方案--------------------
Regex.IsMatch(s,@"^((-?1)|(-?0\.\d{1,6})|0)$")