Skip to content

Instantly share code, notes, and snippets.

@sethdavis512
Last active August 4, 2022 06:34
Show Gist options
  • Save sethdavis512/0e623d164a8f53a948f6baf0df393c0c to your computer and use it in GitHub Desktop.
Save sethdavis512/0e623d164a8f53a948f6baf0df393c0c to your computer and use it in GitHub Desktop.
// HTML5 Pattern
// http://html5pattern.com/
const alphaNumeric = /[a-zA-Z0-9]+/;
const userNameWith20Chars = /^[a-zA-Z][a-zA-Z0-9-_\.]{1,20}$/;
const twitterHandle = /^[A-Za-z0-9_]{1,15}$/;
const password = /^(?=.*\d)(?=.*[a-z])(?=.*[A-Z])(?!.*\s).*$/; // Uppercase, lowercase, and number
const password2 = /^(?=.*\d)(?=.*[a-z])(?=.*[A-Z])(?!.*\s).*$/; // Password (UpperCase, LowerCase, Number/SpecialChar and min 8 Chars)
// TX NIC
const simplePattern = /^[a-zA-Z0-9!?#$@~*(),\-_|':\s]+$/;
// Dollar
const dollar = /^(?!0\.00)[1-9]\d{0,2}(,\d{3})*(\.\d\d)?$/;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment