(function(){functionstripHtml(value){// remove html tags and space charsreturnvalue.replace(/<.[^<>]*?>/g," ").replace(/ | /gi," ")// remove punctuation.replace(/[.(),;:!?%#$'\"_+=\/\-“”’]*/g,"");}$.validator.addMethod("maxWords",function(value,element,params){returnthis.optional(element)||stripHtml(value).match(/\b\w+\b/g).length<=params;},$.validator.format("Please enter {0} words or less."));$.validator.addMethod("minWords",function(value,element,params){returnthis.optional(element)||stripHtml(value).match(/\b\w+\b/g).length>=params;},$.validator.format("Please enter at least {0} words."));$.validator.addMethod("rangeWords",function(value,element,params){varvalueStripped=stripHtml(value),regex=/\b\w+\b/g;returnthis.optional(element)||valueStripped.match(regex).length>=params[0]&&valueStripped.match(regex).length<=params[1];},$.validator.format("Please enter between {0} and {1} words."));}());