-
-
Save leavyli/41203f8f291db792d079db0c974dd958 to your computer and use it in GitHub Desktop.
Revisions
-
leavyli renamed this gist
Mar 2, 2018 . 1 changed file with 0 additions and 0 deletions.There are no files selected for viewing
File renamed without changes. -
leavyli created this gist
Mar 2, 2018 .There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,12 @@ <?php //输出结果string(115) "mobile: 13929****47,13929****47,13929****47,13929****47,1****3,13929****47,13929****47, name:liwei, moblie: 1****6" $s = "mobile: 13929571847,13929527847,13929517847,13929575847,123,13929575847,13929575847, name:liwei, moblie: 12636"; $p =[ "/(.*?)(\d)(\d{1,4})(\d{1,2},)/", "/(.*?)(\d)(\d{1,4})(\d{1,2}$)/", ]; $r = [ '\1\2****\4', '\1\2****\4', ]; $res = preg_replace($p, $r, $s);