0~90的浮点数

解决方案 »

  1.   

    ^\d(\.\d+?)|[1-8]\d(\.\d+?)$
    无法测试...
      

  2.   


                    string strHtml = "89.001";            Regex re = new Regex(@"^([0-9]|90|[1-8][0-9])(\.[0-9]+)?$");
                MatchCollection mc = re.Matches(strHtml);
                foreach(Match m in mc)
                    Console.WriteLine(m.Value);
             
      

  3.   

    再次修改,应该包含0的。
    ^(\d|[1-8]\d|90)(\.\d+)?$
      

  4.   

    其实楼主可以不使用正则表达式。可以用double.Parse()方法转换成double类型,判断一下大小就是了。
      

  5.   


    呵呵,double.TryParse()也挺好的。
    非要用正则就用 ^(([0-9]|[1-8][0-9])(\.[0-9]+)?|90)$