日期:2014-05-20  浏览次数:20680 次

求正则表达式 只许输入 数字 和 点
如题 请帮写一个把 只允许输入 数字 和 点 

不是小数点

------解决方案--------------------
[\d\\.]+
------解决方案--------------------
一段测试程序,供参考
Java code

BufferedReader r = new BufferedReader(new InputStreamReader(System.in));
        Pattern p = Pattern.compile("[\\d\\.]*");
        String s;
        while((s = r.readLine())!= null){
            Matcher m = p.matcher(s);
            System.out.println(m.matches()?"match":"not match");
            System.out.println(" ");
        }

------解决方案--------------------
探讨
我意思 是 文本框输入 的只能是 数字 和 点

大家就这个 [\d\\.]+$ 但是输入汉字 也能提交

唉 不知你们在 说什么 计算机 语言 就是工具, 狗屁技术