SHARE
TWEET

Untitled

a guest Feb 15th, 2019 87 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. // Digits
  2. /^[0-9]+$/
  3.  
  4. // Alphabetic Characters
  5. /^[a-zA-Z]+$/
  6.  
  7. // Alpha-Numeric Characters
  8. /^[a-zA-Z0-9]+$/
  9.  
  10. // Date (MM/DD/YYYY)/(MM-DD-YYYY)/(MM.DD.YYYY)/(MM DD YYYY)
  11. /^(0?[1-9]|1[012])[- /.](0?[1-9]|[12][0-9]|3[01])[- /.](19|20)?[0-9]{2}$/
  12.    
  13. // Email Address
  14. /^[a-zA-Z0-9._%-]+@[a-zA-Z0-9.-]+.[a-zA-Z]{2,4}$/
  15.  
  16. /** Password
  17. * The password must contain
  18. - one lowercase letter,
  19. - one uppercase letter,
  20. - one number,
  21. - one unique character such as !@#$%^&?
  22. - at least 6 characters long.
  23. **/
  24. /^.*(?=.{6,})(?=.*d)(?=.*[A-Z])(?=.*[a-z])(?=.*[!@#$%^&*? ]).*$/
  25.    
  26. // Slug
  27. /^[a-z0-9-]+$/
  28.    
  29. // URL
  30. /((([A-Za-z]{3,9}:(?:\/\/)?)(?:[-;:&=\+\$,\w]+@)?[A-Za-z0-9.-]+|(?:www.|[-;:&=\+\$,\w]+@)[A-Za-z0-9.-]+)((?:\/[\+~%\/.\w-_]*)?\??(?:[-\+=&;%@.\w_]*)#?(?:[\w]*))?)/
  31.  
  32. // IP Address
  33. /^(?:(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?).){3}(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)$/
  34.  
  35. // Remove all character except numbers and letters
  36. string = string.replace(/[^a-zA-Z0-9]/g, '');
  37.  
  38. // specifying the characters you want to remove
  39. string = string.replace(/[&\/\\#,+()$~%.'":*?<>{}]/g, '');
  40.  
  41. var desired = stringToReplace.replace(/[^\w\s]/gi, '')
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top