Last active
December 17, 2015 02:19
-
-
Save Tushkiz/5535079 to your computer and use it in GitHub Desktop.
Common Regular Expressions
This file contains 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
// Common Regular Expression | |
// Email Address | |
/* Humans */ var emailHuman = /[-\w.]+@([A-z0-9][-A-z0-9]+\.)+[A-z]{2,4}/i; | |
/* Bots */ var emailBots = /^[\w!#$%&\’*+\/=?^`{|}~.-]+@(?:[a-z\d][a-z\d-]*(?:\.[a-z\d][a-z\d-]*)?)+\.(?:[a-z][a-z\d-]+)$/i; | |
// Date | |
var datePattern = /([01]?\d)[-\/ .]([0123]?\d)[-\/ .](\d{4})/; | |
// Web Address | |
var urlPattern = /^((https?:\/\/)|(www\.))\S*$/; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment