Article Directory
When we write the form, we will use some regular expressions to verify whether it is correct. Here are some common regular expressions.
Commonly used regular expressions in jquery API
In this there is an API in jquery link
Some other regular expressions
(Spaces are added after ^, don’t forget to delete the spaces after ^ when writing)
//If the input is a combination of numbers and English, it can only be 6-16 characters, if it is Chinese, it can only be 2-6 characters
/(^ [a-zA-Z0-9_-]{6,16}$)|(^ [\u2E80-\u9FFF]{2,6})/
Can only be a positive integer
/^ [1-9]\d*$/
It can only be a positive decimal, and cannot appear like 01111. Two digits are reserved after the decimal point
/^(0?|[1-9]\d*)(.\d{0,2})?$/
The point to be emphasized here is that this regular expression cannot judge multiple points, just like the following
I input multiple points, and it returns true
...oh my god!
No other problems.
end
I hope that the friends you see have good regular expressions to add in time