当前位置:网站首页>Regular expressions for judging positive integers
Regular expressions for judging positive integers
2022-04-23 19:08:00 【Little brother】
Regular expressions of positive numbers ( Include 0, Keep two decimal places ):^((0{1}\.\d{1,2})|([1-9]\d*\.{1}\d{1,2})|([1-9]+\d*)|0)$
Regular expressions of positive numbers ( barring 0, Keep two decimal places ):^((0{1}\.\d{1,2})|([1-9]\d*\.{1}\d{1,2})|([1-9]+\d*))$
Regular expressions for positive integers ( Include 0):^[+]{0,1}(\d+)$
Regular expressions for positive integers ( barring 0):^[1-9]\d*$
discount (0-1) Regular expressions for decimals ( Include 1):^(0\.\d+|1)$
discount (0-1) Regular expressions for decimals ( barring 1):^(0\.\d+)$
Android Usage method :
if(" What to verify ".matches(^(0\.\d+|1)$)){
return true;
}
VS Usage method :
var reg = /^(0\.\d+|1)$/g;
if (!reg.test(" What to verify ")) {
layer.msg(" The content to be verified must be a positive integer or a positive decimal (2 Decimal place )!", { icon: 5, anim: 6 });
}
版权声明
本文为[Little brother]所创,转载请带上原文链接,感谢
https://yzsam.com/2022/04/202204210601422535.html
边栏推荐
- Use of kotlin collaboration in the project
- Wechat video extraction and receiving file path
- Some records used by VS2010
- Introduction to ROS learning notes (II)
- FTP、ssh远程访问及控制
- SSDB基础2
- 【玩转Lighthouse】腾讯云轻量服务器搭建全平台视频解析视频下载网站
- Installation, use and problem summary of binlog2sql tool
- Tencent cloud GPU best practices - remote development training using jupyter pycharm
- [record] typeerror: this getOptions is not a function
猜你喜欢

为何PostgreSQL即将超越SQL Server?

Raspberry pie uses root operation, and the graphical interface uses its own file manager

FTP、ssh远程访问及控制

ESP32 LVGL8. 1 - img picture (IMG 20)

The difference between ordinary inner class and static inner class

ESP32 LVGL8. 1 - checkbox (checkbox 23)

mysql通过binlog恢复或回滚数据

微搭低代码零基础入门课(第三课)

OpenHarmony开源开发者成长计划,寻找改变世界的开源新生力!

Solutions such as unknown or garbled code or certificate problem prompt in Charles's mobile phone packet capture, actual measurement.
随机推荐
The type initializer for ‘Gdip‘ threw an exception
RPM package management
C1000k TCP connection upper limit test
SSDB基础3
Using bafayun to control the computer
SQL常用的命令
7、 DOM (Part 2) - chapter after class exercises and answers
Scrollto and scrollby
WebView opens H5 video and displays gray background or black triangle button. Problem solved
mysql通过binlog恢复或回滚数据
Yyds dry goods inventory stringprep --- Internet string preparation
Codeforces Round #784 (Div. 4)
Sentinel service fusing practice (sentinel integration ribbon + openfeign + fallback)
js 计算时间差
How can programmers quickly develop high-quality code?
openlayers 5.0 离散聚合点
Esp32 drive encoder -- siq-02fvs3 (vscade + IDF)
c1000k TCP 连接上限测试1
Using 8266 as serial port debugging tool
Methods of nested recycleview to solve sliding conflict and incomplete item display