Skip to content

Commit

Permalink
Reduce some regexes
Browse files Browse the repository at this point in the history
  • Loading branch information
chriso committed Mar 15, 2015
1 parent 2a901b6 commit 8ab46e4
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 7 deletions.
12 changes: 6 additions & 6 deletions validator.js
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@
var isbn10Maybe = /^(?:[0-9]{9}X|[0-9]{10})$/
, isbn13Maybe = /^(?:[0-9]{13})$/;

var ipv4Maybe = /^(\d?\d?\d)\.(\d?\d?\d)\.(\d?\d?\d)\.(\d?\d?\d)$/
var ipv4Maybe = /^(\d+)\.(\d+)\.(\d+)\.(\d+)$/
, ipv6Block = /^[0-9A-F]{1,4}$/i;

var uuid = {
Expand All @@ -58,13 +58,13 @@
, all: /^[0-9A-F]{8}-[0-9A-F]{4}-[0-9A-F]{4}-[0-9A-F]{4}-[0-9A-F]{12}$/i
};

var alpha = /^[a-zA-Z]+$/
, alphanumeric = /^[a-zA-Z0-9]+$/
var alpha = /^[A-Z]+$/i
, alphanumeric = /^[0-9A-Z]+$/i
, numeric = /^[-+]?[0-9]+$/
, int = /^(?:[-+]?(?:0|[1-9][0-9]*))$/
, float = /^(?:[-+]?(?:[0-9]+))?(?:\.[0-9]*)?(?:[eE][\+\-]?(?:[0-9]+))?$/
, hexadecimal = /^[0-9a-fA-F]+$/
, hexcolor = /^#?([0-9a-fA-F]{3}|[0-9a-fA-F]{6})$/;
, hexadecimal = /^[0-9A-F]+$/i
, hexcolor = /^#?([0-9A-F]{3}|[0-9A-F]{6})$/i;

var ascii = /^[\x00-\x7F]+$/
, multibyte = /[^\x00-\x7F]/
Expand All @@ -73,7 +73,7 @@

var surrogatePair = /[\uD800-\uDBFF][\uDC00-\uDFFF]/;

var base64 = /^(?:[A-Za-z0-9+\/]{4})*(?:[A-Za-z0-9+\/]{2}==|[A-Za-z0-9+\/]{3}=|[A-Za-z0-9+\/]{4})$/;
var base64 = /^(?:[A-Z0-9+\/]{4})*(?:[A-Z0-9+\/]{2}==|[A-Z0-9+\/]{3}=|[A-Z0-9+\/]{4})$/i;

var phones = {
'zh-CN': /^(\+?0?86\-?)?1[345789]\d{9}$/,
Expand Down

0 comments on commit 8ab46e4

Please sign in to comment.