Provides various official and user-released code examples and code reference. You are welcome to exchange and learn in daily project development. Regular Expressions are required to verify the validity of some data. These regular expressions are also commonly added to your favorites. Some of them may be unsuitable. But you can modify it one or two as needed.
// Verify the mobile phone number
$ Match = '/^ (13 [0-9]) | (15 [^ 4, \ d]) | (18 [0, 5-9]) [0-9] {8} $ /';
// Verify the landline
$ Match = '/^ (0 [0-9] {2, 3 }\-)? ([2-9] [0-9] {6, 7}) + (\-[0-9] {1, 4 })? $ /';
// Verify the ID card number of 15 or 18 digits
$ Match = '/(^ \ d {15} $) | (^ \ d {17} (\ d | X | x) $ )/';
// Email Verification
$ Match = '/^ \ w + ([-+.] \ w +) * @ \ w + ([-.] \ w + )*\. \ w + ([-.] \ w +) * $ /';
// Convert the intermediate mobile phone number *
$ Tel = 18612345678;
$ Pattern = '/(\ d {3}) \ d {4} (\ d {3 })/';
$ Replacement = "\ $1 ***** \ $2 ";
Echo preg_replace ($ pattern, $ replacement, $ tel );
AD: truly free, domain name + VM + enterprise mailbox = 0 RMB