Last active
          May 17, 2018 01:30 
        
      - 
      
 - 
        
Save JSoon/fe42922b06f497919cfe838b995c56b9 to your computer and use it in GitHub Desktop.  
    正则表达式
  
        
  
    
      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 characters
    
  
  
    
  | // 中文字符集(简体、繁体、双字节字符) | |
| var regExp = /[\u4e00-\u9fa5x00-xff]/g; | |
| // 中国大陆手机号码 | |
| var regExp = /^1[0-9]{10}$/; // 一般情况 | |
| var regExp = /^1[3|4|5|7|8][0-9]{9}$/; // 目前精确情况,电信,移动,联通目前发行的号码(截止2018年1月5日) | |
| // 替换11位手机号中间4位 | |
| var mobileNumber = '13512345678'; | |
| mobileNumber.replace(/(\d{3})\d{4}(\d{4})/, '$1 **** $2'); // 135 **** 5678 | 
  
    Sign up for free
    to join this conversation on GitHub.
    Already have an account?
    Sign in to comment