Skip to content

Instantly share code, notes, and snippets.

@luisenriquecorona
Created November 24, 2020 18:33
Show Gist options
  • Save luisenriquecorona/02ac5f31a868dcce808a2fb2443217fc to your computer and use it in GitHub Desktop.
Save luisenriquecorona/02ac5f31a868dcce808a2fb2443217fc to your computer and use it in GitHub Desktop.
Passphrase.js
var input = prompt("Please enter a pass phrase.", "");
function isValid (text) {
var myRegExp = /[^a-z\d ]/i;
return !(myRegExp.test(text));
}
if (isValid(input)) {
alert("Your passphrase contains only valid characters");
} else {
alert("Your passphrase contains one or more invalidcharacters");
}
@luisenriquecorona
Copy link
Author

Sharing

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment