当前位置:网站首页>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
边栏推荐
- [record] typeerror: this getOptions is not a function
- Raspberry pie uses root operation, and the graphical interface uses its own file manager
- Codeforces Round #784 (Div. 4)
- FTP, SSH Remote Access and control
- 腾讯云GPU最佳实践-使用jupyter pycharm远程开发训练
- ESP32 LVGL8. 1 - input devices (input devices 18)
- Class loading process of JVM
- [报告] Microsoft :Application of deep learning methods in speech enhancement
- #yyds干货盘点#stringprep --- 因特网字符串预备
- Scrollto and scrollby
猜你喜欢
Client interns of a large factory share their experience face to face
Esp32 (UART ecoh) - serial port echo worm learning (2)
Solutions such as unknown or garbled code or certificate problem prompt in Charles's mobile phone packet capture, actual measurement.
剑指 Offer II 116. 省份数量-空间复杂度O(n),时间复杂度O(n)
開關電源設計分享及電源設計技巧圖解
MVVM model
Esp32 (UART receiving and sending) - receiving and sending communication of serial port (4)
该买什么设备,Keysight 给你挑好了
【C语言进阶11——字符和字符串函数及其模拟实现(2))】
ESP32 LVGL8. 1 - roller rolling (roller 24)
随机推荐
Click the input box to pop up the keyboard layout and move up
Implementation of TCP UDP communication with golang language
Seata handles distributed transactions
The difference between ordinary inner class and static inner class
Download xshell 6 and xftp6 official websites
Simplified path (force buckle 71)
Wechat video extraction and receiving file path
openlayers draw矩形
Esp32 (UART ecoh) - serial port echo worm learning (2)
2022.04.23(LC_714_买卖股票的最佳时机含手续费)
std::stoi stol stoul stoll stof stod
c1000k TCP 连接上限测试1
WebView saves the last browsing location
Introduction to ROS learning notes (II)
SSDB基础2
高层次人才一站式服务平台开发 人才综合服务平台系统
Nacos cluster construction and MySQL persistence configuration
ESP32 LVGL8. 1 - bar progress bar (bar 21)
ESP32 LVGL8. 1 - img picture (IMG 20)
Wechat applet part of the mobile phone Preview PDF did not respond