You may use pattern
defined in the additional-methods.js
file. Note that this additional-methods.js file must be included after jQuery Validate dependency, then you can just use
$("#frm").validate({_x000D_
rules: {_x000D_
Textbox: {_x000D_
pattern: /^[a-zA-Z'.\s]{1,40}$/_x000D_
},_x000D_
},_x000D_
messages: {_x000D_
Textbox: {_x000D_
pattern: 'The Textbox string format is invalid'_x000D_
}_x000D_
}_x000D_
});
_x000D_
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>_x000D_
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery-validate/1.17.0/jquery.validate.js"></script>_x000D_
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery-validate/1.17.0/additional-methods.min.js"></script>_x000D_
<form id="frm" method="get" action="">_x000D_
<fieldset>_x000D_
<p>_x000D_
<label for="fullname">Textbox</label>_x000D_
<input id="Textbox" name="Textbox" type="text">_x000D_
</p>_x000D_
</fieldset>_x000D_
</form>
_x000D_