当前位置:网站首页>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
边栏推荐
- Using 8266 as serial port debugging tool
- SSDB foundation 3
- Getting started with vcpkg
- Sentinel service fusing practice (sentinel integration ribbon + openfeign + fallback)
- MySQL Téléchargement et installation de la version Linux
- Esp32 (UART event) - serial port event learning (1)
- Oracle配置st_geometry
- ESP32 LVGL8. 1 - arc (arc 19)
- Sword finger offer II 116 Number of provinces - spatial complexity O (n), time complexity O (n)
- Treatment of incomplete display of listview height
猜你喜欢
MySQL Téléchargement et installation de la version Linux
Oracle配置st_geometry
Network protocol: SCTP flow control transmission protocol
Esp32 (UART 485 communication) - 485 communication of serial port (3)
Practice of Druid SQL and security in meituan review
On the forced conversion of C language pointer
mysql通过binlog恢复或回滚数据
[记录]TypeError: this.getOptions is not a function
ESP32 LVGL8. 1. Detailed migration tutorial of m5stack + lvgl + IDF (27)
Introduction to ROS learning notes (I)
随机推荐
Esp01s with Arduino development environment
ESP32 LVGL8. 1 - roller rolling (roller 24)
C: generic reflection
redis优化系列(三)解决主从配置后的常见问题
WebView saves the last browsing location
openlayers 5.0 热力图
Advanced transfer learning
Tencent cloud GPU best practices - remote development training using jupyter pycharm
Esp32 (UART event) - serial port event learning (1)
Dynamically add and delete layouts
Esp32 (UART receiving and sending) - receiving and sending communication of serial port (4)
Screen right-click menu in souI
Is it safe to open an account in Bohai futures.
微搭低代码零基础入门课(第三课)
The difference between ordinary inner class and static inner class
Raspberry pie 18b20 temperature
mysql_linux版本的下载及安装详解
Some records used by VS2010
Esp32 (UART 485 communication) - 485 communication of serial port (3)
Recyclerview control list item layout match_ Fundamental principle of parent attribute invalidation