求一正则表达式 求一正则表达式 输入不许为0,可以是正数负数或小数 0.2 允许. 但是 0 或 0.0 0.00000 不允许 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 Regex rx = new Regex(@"^\-?(([1-9]\d*)(\.\d+)?)|(0\.\d+[1-9])$"); 自己可以写个控制台程序测试一下:Regex rx = new Regex(@"^\-?(([1-9]\d*)(\.\d+)?)|(0\.\d+[1-9])$"); string str = Console.ReadLine(); while (str != "exit") { if ((rx.Match(str)).Success) { Console.WriteLine("yes"); } else { Console.WriteLine("no"); } str = Console.ReadLine(); } 输入不许为0,可以是正数负数或小数 0.2 允许. 但是 0 或 0.0 0.00000 不允许-----------------------------------------------^\-?([1-9]\d*|(0|[1-9]\d*)\.\d*[1-9])$取$0的值,已调试 ^\-?(([1-9]\d*)(\.\d+)?)|(0\.\d*[1-9])$ httpModules在IIS7下,应该怎么办啊? 刚学jquery不值 ASP.NET书籍 css样式问题 急!!!!!asp.net高手请进!我的网页cpu占用好高! 这样的多对一的聊天是怎么弄的,求大家给个思路,谢谢! 急 急 急 急 !怎样把access语句换成sql语句 Include在ASP.NET FOR C#<html>中为何不能用? 有c#+sql或c#+acess的asp.net的简单例子吗 怎么让ascx控件再加载一次? 五种提高 SQL Server 性能的方法 关于两个网页传值的问题,两个网页都打开状态下传值.
string str = Console.ReadLine();
while (str != "exit")
{
if ((rx.Match(str)).Success)
{
Console.WriteLine("yes");
}
else
{
Console.WriteLine("no");
}
str = Console.ReadLine();
}
-----------------------------------------------
^\-?([1-9]\d*|(0|[1-9]\d*)\.\d*[1-9])$
取$0的值,已调试