Lao Wang is crazy about visualization these days.
For example, algorithm visualization, regular visualization, Vue data hijacking visualization……
The process of running a program is invisible, and if you can visualize everything, the difficulty of understanding will be greatly reduced.
Three JS regular visualization tools
- https://jex.im/regulex
- https://regexper.com (Internet free)
- https://aoxiaoqiang.github.io/reg (alternative)
- https://www.debuggex.com
Common regular expressions
The following image was generated by https://jex.im/regulex
The value can contain only letters, digits, underscores (_), periods (.), and hyphens (-)
^[a-zA-Z0-9_-]+@[a-zA-Z0-9_-]+(\.[a-zA-Z0-9_-]+)+$
Copy the code
The phone
Mobile phone number
13012345678 Mobile number
^1(3|4|5|6|7|8|9)\d{9}$
Copy the code
Fixed telephone
Xxxx-xxxxxxx XXXX-XXXXXXXX Fixed telephone number
(\ \ d {3, 4} \) | \ d {3, 4} - | \ s)? \d{8}Copy the code
The domain name
https://google.com/
^((http:\/\/)|(https:\/\/))? ([a - zA - Z0-9] ([a zA - Z0-9 \], 21 {0} [a - zA - Z0-9])? \.) + [a zA - Z] {2, 6} (\ /)Copy the code
IP
127.0.0.1
((? : (? :25[0-5]|2[0-4]\d|[01]? \d? \d)\.) {3} (? :25[0-5]|2[0-4]\d|[01]? \d? \d))Copy the code
Account check
Laowang_001 starts with a letter. 5-16 bytes are allowed. Alphanumeric underscores are allowed
^ [a zA - Z] [a - zA - Z0-9 _] {4, 15} $Copy the code
Character checking
Chinese characters
The front of pharaoh
^[\u4e00-\u9fa5]{0,}$
Copy the code
English and Numbers
^[A-Za-z0-9]+$
Copy the code
The value contains 3 to 20 characters
^. {3, 20} $Copy the code
The English characters
The value is a string of 26 English letters
^[A-Za-z]+$
Copy the code
A string consisting of 26 uppercase English letters
^[A-Z]+$
Copy the code
The value is a string of 26 lowercase letters
^[a-z]+$
Copy the code
The value is a string of 26 letters and numbers
^[A-Za-z0-9]+$
Copy the code
The value is a string of 26 letters, digits, and underscores
^\w+$
Copy the code
Chinese, English, and digits including underscores (_)
^[\u4E00-\u9FA5A-Za-z0-9_]+$
Copy the code
Chinese characters, English characters, digits but not underscores
^[\u4E00-\u9FA5A-Za-z0-9]+$
Copy the code
Disallow input containing %&’,; =? $” character, etc
[^%&',;=?$\x22]+
Copy the code
Do not enter characters containing ~
[^~\x22]+
Copy the code
Number of regular
The integer
^ -? [1-9]\d*$Copy the code
Positive integer
^[1-9]\d*$
Copy the code
Negative integer
^-[1-9]\d*$
Copy the code
Non-negative integer
^[1-9]\d*|0$
Copy the code
A positive integer
^-[1-9]\d*|0$
Copy the code
Floating point Numbers
^ -? ([1-9]\d*\.\d*|0\.\d*[1-9]\d*|0? $\. | 0 + 0)Copy the code
Are floating point Numbers
^[1-9]\d*\.\d*|0\.\d*[1-9]\d*$
Copy the code
Negative floating point number
^-([1-9]\d*\.\d*|0\.\d*[1-9]\d*)$
Copy the code
Non-negative floating point number
^[1-9]\d*\.\d*|0\.\d*[1-9]\d*|0? \. | 0 0 + $Copy the code
A non-positive floating point number
^(-([1-9]\d*\.\d*|0\.\d*[1-9]\d*))|0? \. | 0 0 + $Copy the code
Find me
- Public account “Front End Siege”
- Discover great projects on Github