Regular expressions strictly verify ID card information $ a130316770827005; $ reg18 [1-9] d {5} (1 [9 | 8]) d {2 }) | (20 [0-1] d) (0d) | (1 [0-2]) ([0 | 1 | 2] d) | 3 [0-1]) d {3} ([0-9] | X); $ reg15 [1-9] d {7} (0d) | (1 [0-2]) ([0 Regular expressions strictly verify ID card information
$ A = '000000'; $ reg18 = '/[1-9] \ d {5} (1 [9 | 8]) \ d {2 }) | (20 [0-1] \ d) (0 \ d) | (1 [0-2]) ([0 | 1 | 2] \ d) | 3 [0-1]) \ d {3} ([0-9] | X )/'; $ reg15 = '/[1-9] \ d {7} (0 \ d) | (1 [0-2]) ([0 | 1 | 2] \ d) | 3 [0-1]) \ d {3}/'; the problem is that the year is determined from 1800 to 2019.
You need to modify the configuration within four years.
In fact, it can be stricter. Preg_match ($ reg15, $ a, $ mm); var_dump ($ mm); output result array (size = 6) 0 => string '123' (length = 15) 1 => string '08 '(length = 2) 2 => string '08' (length = 2) 3 => string ''(length = 0) 4 => string '27' (length = 2) 5 => string '27' (length = 2)