validation.js 389 B

123456789101112
  1. module.exports = {
  2. regex: {
  3. azAZ09_: /^[A-Za-z0-9_]+$/,
  4. az09_: /^[a-z0-9_]+$/,
  5. emailSimple: /^[\x00-\x7F]+@[a-z0-9]+\.[a-z0-9]+(\.[a-z0-9]+)?$/,
  6. password: /^(?=.*[a-z])(?=.*[A-Z])(?=.*\d)(?=.*[$@$!%*?&])[A-Za-z\d$@$!%*?&]/,
  7. ascii: /^[\x00-\x7F]+$/
  8. },
  9. isLength: (string, min, max) => {
  10. return !(typeof string !== 'string' || string.length < min || string.length > max);
  11. }
  12. };