Dev Tools Image Tools Net Tools Regular Expression Tester Pattern:
Text:
Test Regex Replace With:
Replace 1. Numbers Any digit: ^[0-9]*$
Exactly n digits: ^d{n}$
At least n digits: ^d{n,}$
Between m and n digits: ^d{m,n}$
Zero or non-zero starting number: ^(0|[1-9][0-9]*)$
Non-zero starting number with up to two decimal places: ^([1-9][0-9]*)+(.[0-9]{1,2})?$
Positive or negative number with 1-2 decimal places: ^(-)?d+(.d{1,2})$
Positive, negative, or decimal number: ^(-|+)?d+(.d+)?$
Positive real number with exactly two decimal places: ^[0-9]+(\.[0-9]2)?$
Non-negative integer: ^\d+$
or ^[1-9]\d*|0$
Non-positive integer: ^-[1-9]\d*|0$
Float number: ^(-?\d+)(\.\d+)?$
Positive float number: ^[1-9]\d*\.\d*|0\.\d*[1-9]\d*$
Negative float number: ^-([1-9]\d*\.\d*|0\.\d*[1-9]\d*)$
2. Characters Uppercase English letters: ^[A-Z]+$
Lowercase English letters: ^[a-z]+$
English letters and digits: ^[A-Za-z0-9]+$
English letters, digits, and underscores: ^\w+$
Chinese characters, English letters, and digits: ^[\u4E00-\u9FA5A-Za-z0-9]+$
Chinese characters, English letters, digits, and underscores: ^[\u4E00-\u9FA5A-Za-z0-9_]+$
Double-byte characters (including Chinese): [^\x00-\xff]
3. Special Cases Email: ^[a-zA-Z0-9_-]+@[a-zA-Z0-9_-]+(\.[a-zA-Z0-9_-]+)+$
Phone Number: ^1(3|4|5|6|7|8|9)\d9$
Fixed Phone Number (XXX-XXXXXXX or XXXX-XXXXXXXX): ((d{3,4})|d{3,4}-|s)?d{8}
Domain Name: ^((http://)|(https://))?([a-zA-Z0-9]([a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?.)+[a-zA-Z]{2,6}(/)
IPv4 Address: ((?:(?:25[0-5]|2[0-4]\d|[01]?\d?\d)\.)3(?:25[0-5]|2[0-4]\d|[01]?\d?\d))
HTML Tag: <(S*?)[^>]*>.*?|<.*? />
Date (YYYY-MM-DD): ^d{4}-d{1,2}-d{1,2}$
Password (starts with a letter, 6-18 characters, includes letters, digits, and underscores): ^[a-zA-Z]w{5,17}$
Password (must include uppercase and lowercase letters and digits, 8-10 characters, no special characters): ^(?=.*d)(?=.*[a-z])(?=.*[A-Z])[a-zA-Z0-9]{8,10}$
Password (must include uppercase and lowercase letters and digits, 8-10 characters, may include special characters): ^(?=.*d)(?=.*[a-z])(?=.*[A-Z]).{8,10}$