Skip to content

Instantly share code, notes, and snippets.

@cgkio
Created December 11, 2013 19:52
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save cgkio/7917235 to your computer and use it in GitHub Desktop.
Save cgkio/7917235 to your computer and use it in GitHub Desktop.
Regex remove everything after @ (including @)
REGEX: Trim everything up to and including =
var text = "john@aol.com";
text = text.replace(/@.*$/,"");
console.log(text);
// results = "john"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment