- Validation numbers: ^[0-9]*$
- Verify n digits: ^\d{n}$
- Verify at least n digits: ^\d{n,}$
- Verify mn digits: ^\d{m,n}$
- Validate zero and non-zero leading numbers: ^(0|[1-9][0-9]*)$
- Validate positive real numbers with two decimal places: ^[0-9]+(.[0-9]{2})?$
- Verify positive real numbers with 1-3 decimal places: ^[0-9]+(.[0-9]{1,3})?$
- Validate non-zero positive integers: ^\+?[1-9][0-9]*$
- Validate non-zero negative integers: ^\-[1-9][0-9]*$
- Validate non-negative integers (positive integer + 0 ): ^\d+$
- Validate non-positive integers (negative integers + 0 ): ^((-\d+)|(0+))$
- Validate characters of length 3 : ^.{3}$
- Validate a string of 26 English letters: ^[A-Za-z]+$
- Validate a string of 26 uppercase English letters: ^[AZ]+$
- Validate a string consisting of 26 lowercase English letters: ^[az]+$
- Validate a string consisting of numbers and 26 English letters: ^[A-Za-z0-9]+$
- Validate a string consisting of numbers, 26 English letters or underscores: ^\w+$
- Start with a letter, length between 6-18 , can only contain characters, numbers and underscores : ^[a-zA-Z]\w{5,17}$
- Verify that it contains characters such as ^%&',;=?$\": [^%&',;=?$\x22]+
- Verify Chinese characters: ^[\u4e00-\u9fa5],{0,}$
- Verify Email Address: ^\w+[-+.]\w+)*@\w+([-.]\w+)*\.\w+([-.]\w+)*$
- 验证InternetURL:^http://([\w-]+\.)+[\w-]+(/[\w-./?%&=]*)?$
- Verify phone number: ^(((13[0-9])|(15([0-3]|[5-9]))|(18[0,5-9]))\d{8}) |(0\d{2}-\d{7,8})|(0\d{3}-\d{7,8})$
- Verify ID number (15 or 18 digits): ^\d{15}|\d{18}|\d{17}X$
- Verify the 12 months of a year: ^(0?[1-9]|1[0-2])$ The correct format is: "01"-"09" and "1" "12"
- Verify the 31 days of a month: ^((0?[1-9])|((1|2)[0-9])|30|31)$ The correct format is: 01, 09 and 1, 31.
- Integer: ^-?\d+$
- Non-negative float (positive float + 0 ): ^\d+(\.\d+)?$
- Non-positive float (negative float + 0 ): ^((-\d+(\.\d+)?)|(0+(\.0+)?))$
- Number of floating points ^ (-(([0-9] + \. [0-9] * [1-9] [0-9] *) | ([0-9] * [1-9] [0- 9] * \. [0-9] +) | ([0-9] * [1-9] [0-9] *))) $
- float ^(-?\d+)(\.\d+)?$
List of common regular expressions
Guess you like
Origin http://43.154.161.224:23101/article/api/json?id=325716639&siteId=291194637
Recommended
Ranking