Skip to content

Instantly share code, notes, and snippets.

@Pushplaybang
Last active August 29, 2015 14:23
Show Gist options
  • Save Pushplaybang/145fd12ff868cfc9cd78 to your computer and use it in GitHub Desktop.
Save Pushplaybang/145fd12ff868cfc9cd78 to your computer and use it in GitHub Desktop.
My JS regex ref
// HashTags
var simpleHash = /#\w+/g;
var complexHash = /\B#\w*[a-zA-Z]+\w*/g; // this seems uneccessary
// eg :
var input = "this is a #string with #tags to be #extracted";
var matches = input.match(sinpleHash);
var matches = input.match(complexHash);
// email
function validateEmail(email) {
var re = /^([\w-]+(?:\.[\w-]+)*)@((?:[\w-]+\.)*\w[\w-]{0,66})\.([a-z]{2,6}(?:\.[a-z]{2})?)$/i;
return re.test(email);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment