JSFiddle - React, Tailwind, and code Playground

by harifrais

HTML

<script src="http://ajax.aspnetcdn.com/ajax/jquery.validate/1.11.1/jquery.validate.min.js"></script>
<form id="myForm">
    <input id='experience' name="experience" value=""/>
    <input type="submit" value="Go"/>
</form>

JavaScript

$(function() {
   $.validator.addMethod("regex", function(value, element, regexpr) {          
     return regexpr.test(value);
   }, "Please enter a valid pasword.");    
    
   $("#myForm").validate({
       rules: {
           experience: {
               required: true,
               regex: /^[ a-z0-9_@.#&+-]*$/

           }
       }
   });
});