Commonly used regular expression judgment

1. Mobile phone number (domestic)

At the beginning of +86 or 0086, at least one null character - the whole is dispensable, appearing at most once

1, one of 3~9, (the last 9 digits) 1-9 can be

^((\+86|0086)(\s+)?)?1[3-9]\d{9}$

2. Mobile phone number (overseas)

More subdivided matching: regular expressions for domestic and foreign mobile phone numbers - selfcs - 博客园(cnblogs.com)

^\+[\d]{1,5}\s[\d]{1,14}$

 3. ID number:

15 or 18 digits, or 17 digits + check digit (X or x)

(^\d{15}$)|(^\d{18}$)|(\d{17}(\d|X|x)$)

4. Email:

^\w+([-+.]\w+)*@\w+([-.]\w+)*\.\w+([-.]\w+)*$

 More: Regular expression online test | rookie tool (runoob.com)

Guess you like

Origin blog.csdn.net/weixin_57092157/article/details/119985962