Skip to content

Instantly share code, notes, and snippets.

@fakiolinho
Last active December 13, 2021 18:44
Show Gist options
  • Save fakiolinho/5438838 to your computer and use it in GitHub Desktop.
Save fakiolinho/5438838 to your computer and use it in GitHub Desktop.
jQuery: Validate Strings with Regex
/* jQuery Validate Strings with Regex */
function validateStrings(string) {
var pattern = /^[0-9a-zA-Z@_-]+$/;
return $.trim(string).match(pattern) ? true : false;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment