2 * Return true if the field value matches the given format RegExp
4 * @example $.validator.methods.pattern("AR1004",element,/^AR\d{4}$/)
7 * @example $.validator.methods.pattern("BR1004",element,/^AR\d{4}$/)
10 * @name $.validator.methods.pattern
12 * @cat Plugins/Validate/Methods
14 $.validator
.addMethod("pattern", function(value
, element
, param
) {
15 if (this.optional(element
)) {
18 if (typeof param
=== "string") {
19 param
= new RegExp("^(?:" + param
+ ")$");
21 return param
.test(value
);
22 }, "Invalid format.");