Common 16 Regular

Time:2020-11-26

1. Password strength test:

^(?=.*\d)(?=.*[a-z])(?=.*[A-Z]).{8,10}$

2. Valid Chinese:

^[\u4e00-\u9fa5]{0,}$

A string consisting of 26 characters

^\w+$

4. E-mail address validation:

[\w!#$%&'*+/=?^_`{|}~-]+(?:\.[\w!#$%&'*+/=?^_`{|}~-]+)*@(?:[\w](?:[\w-]*[\w])?\.)+[\w](?:[\w-]*[\w])?

5. Valid ID card:

15 bits: ^ [1-9] \ \ D {7} ((0 \ \ d) | (1 [0-2]) ((([0 | 1 | 2] \ \ d) | 3 [0-1]) \ \ D {3}$
18 bits: ^ [1-9] \ \ D {5} [1-9] \ \ D {3} ((0 \ \ d) | (1 [0-2]) ((([0 | 1 | 2] \ \ d) | 3 [0-1]) \ \ D {3} ([0-9] | x)$

Consider the “y-ddy-yymm” format.

  ^(?:(?!0000)[0-9]{4}-(?:(?:0[1-9]|1[0-2])-(?:0[1-9]|1[0-9]|2[0-8])|(?:0[13-9]|1[0-2])-(?:29|30)|(?:0[13578]|1[02])-31)|(?:[0-9]{2}(?:0[48]|[2468][048]|[13579][26])|(?:0[48]|[2468][048]|[13579][26])00)-02-29)$

7. Validation amount, accurate to 2 decimal places

 ^[0-9]+(.[0-9]{2})?$

8. Verify the mobile phone number

 ^(13[0-9]|14[5|7]|15[0|1|2|3|5|6|7|8|9]|18[0|1|2|3|5|6|7|8|9])\d{8}$

9. Determine the version of IE

  ^.*MSIE [5-8](?:\.[0-9]+)?(?!.*Trident\/[5-9]\.0).*$

10. Check ip-v4 address

  \b(?:(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.){3}(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\b

11. Check ip-v6 address

   (([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))

12. Check URL prefix

if (!s.match(/^[a-zA-Z]+:\/\//)){
    s = 'http://' + s;
}

13. Extract URL, which can extract URL from a piece of text

^(f|ht){1}(tp|tps):\/\/([\w-]+\.)+[\w-]+(\/[\w- ./?%&=]*)?

14. Extracting hyperlinks on the page

  (<a\s*(?!.*\brel=)[^>]*)(href="https?:\/\/)((?!(?:(?:www\.)?'.implode('|(?:www\.)?', $follow_list).'))[^"]+)"((?!.*\brel=)    [^>]*)(?:[^>]*)>

15. Extract web page images

\< *[img][^\>]*[src] *= *[\"\']{0,1}([^\"\'\ >]*)

16. Extract notes

<!--(.*?)-->