数字的正则表达式 [英] regular expression for numbers

查看:110
本文介绍了数字的正则表达式的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想使用正则表达式,该正则表达式最多包含0到9之间的10位数字和两位小数.

例如

9999999999.99
0123456789.01
999999
12345

I want to use regular expression which contains maximum 10 digits between 0 to 9 and two decimal places.

e.g.

9999999999.99
0123456789.01
999999
12345

推荐答案

^\d{10}


\ d +(\.\ d { 1 2 })?
\d+(\.\d{1,2})?



你应该先用谷歌搜索.有太多可用的链接. :)
看看 [



You should have googled first. There are so many links available. :)
Have a look at this[^] also.


此正则表达式可以为您提供所需的输入信息:
\ d {1,10} \.\ d {2} | \ d {1,10}

有关详细信息,请参见:
Expresso-用于构建和测试正则表达式的工具 [ ^ ]
This reguklar expression would give you some input on what you need:
\d{1,10}\.\d{2}|\d{1,10}

For details see this:
Expresso - A Tool for Building and Testing Regular Expressions[^]


这篇关于数字的正则表达式的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆