Skip to content

Instantly share code, notes, and snippets.

@padolsey
Created June 17, 2012 15:33
Show Gist options
  • Save padolsey/2944861 to your computer and use it in GitHub Desktop.
Save padolsey/2944861 to your computer and use it in GitHub Desktop.
var ALPHA = 'abcdefghijklmnopqrstuvwxyz',
ALPHA_UPPER = ALPHA.toUpperCase(),
NUMERIC = '0123456789',
PUNCTUATION = '-!@£$%^&*()[]{}\'"/?.>,<;:\\|~`€#',
UNDERSCORE = '_',
WHITESPACE = '\x20\t\n\r\f\v\xa0\u2028\u2029\u1680\u180e\u2000-\u200a\u202f\u205f\u3000\ufeff'; // thanks Mathias!
var SHORTHAND_CC = {
'\\S': ALPHA + ALPHA_UPPER + NUMERIC + PUNCTUATION + UNDERSCORE,
'\\s': WHITESPACE,
'\\W': NUMERIC + PUNCTUATION + UNDERSCORE,
'\\w': ALPHA + ALPHA_UPPER + NUMERIC + '_',
'\\d': NUMERIC,
'\\D': ALPHA + ALPHA_UPPER + PUNCTUATION + UNDERSCORE + WHITESPACE
};
@padolsey
Copy link
Author

@mathiasbynens, I wasn't sure where to find that, so thank you! I think my PUNCTUATION is missing a bunch too, but I think it's enough for basic generations.

@mathiasbynens
Copy link

This project moved here: https://github.com/padolsey/rGen

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