Skip to content

Instantly share code, notes, and snippets.

@MaxXxiMast
Last active October 19, 2016 07:16
Show Gist options
  • Save MaxXxiMast/f4c2886a3583157c248b6790d024e857 to your computer and use it in GitHub Desktop.
Save MaxXxiMast/f4c2886a3583157c248b6790d024e857 to your computer and use it in GitHub Desktop.
#RegExp for a alphanumeric value not starting with 0, can have no special characters other that _ or -
//validation check for sku of a product
//alphanumeric
var regExp = "/^[^0][A-Za-z0-9_-]{3,50}$/";
// ^ start of string
// [^0] 1st char will not be 0
// [A-Za-z0-9_-] A or B ... Z or a or b or ... z or 0 or 1 or ... 9 or underscores(_) or hyphen/dash (-)
// {3,50} length between 3-50
// $ end of string
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment