Browse Source

#25: The regexp validator does not work

nghuuphuoc 12 years ago
parent
commit
a5f47fba83
4 changed files with 4 additions and 3 deletions
  1. 1 0
      CHANGELOG.md
  2. 1 1
      dist/js/bootstrapValidator.js
  3. 1 1
      dist/js/bootstrapValidator.min.js
  4. 1 1
      src/js/validator/regexp.js

+ 1 - 0
CHANGELOG.md

@@ -5,6 +5,7 @@ __v0.2.0__
 * Add ```callback``` validator
 * Add ```creditCard``` validator
 * Add ```different``` validator
+* #25: The ```regexp``` validator does not work
 
 __v0.1.1 (2013-10-17)__
 * Add ```submitButtons``` option

+ 1 - 1
dist/js/bootstrapValidator.js

@@ -568,7 +568,7 @@
          */
         validate: function(validator, $field, options) {
             var value = $field.val();
-            return value.match(options.regexp);
+            return options.regexp.test(value);
         }
     };
 }(window.jQuery));

File diff suppressed because it is too large
+ 1 - 1
dist/js/bootstrapValidator.min.js


+ 1 - 1
src/js/validator/regexp.js

@@ -11,7 +11,7 @@
          */
         validate: function(validator, $field, options) {
             var value = $field.val();
-            return value.match(options.regexp);
+            return options.regexp.test(value);
         }
     };
 }(window.jQuery));