Created
          May 9, 2017 23:02 
        
      - 
      
- 
        Save kristopolous/bfcb5b56d43dfa5a126b6864a43963e9 to your computer and use it in GitHub Desktop. 
    simple us regex phone formatter in JS
  
        
  
    
      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
    
  
  
    
  | function phoneFormat(str) { | |
| return str.replace(/[+1]*(\d{3})(\d{3})(.*)/, '1 ($1) $2-$3'); | |
| } | 
  
    Sign up for free
    to join this conversation on GitHub.
    Already have an account?
    Sign in to comment
  
            
This doesn't do anything fancy ... that's not the point.