title: Jquery RegEx Validation
body: <p>I am wanting to check if an input field has the attribute "pattern" and if so, preform a regex check aganst said pattern.I know this is already done by HTML5, but I am wanting to handle the event myself. I am receiving this error: <strong>Uncaught TypeError: Object a-zA-Z has no method 'test'</strong></p>
  
  <pre><code> ///Check Perform Reg///////////////////////////////////////////////////////
           if ($(this).attr("pattern")) {
               var reg = $(this).attr("pattern");
               var currentValue = $(this).val();
  
  
               if (reg.test(currentValue)) {
                   $(this).after($error.clone().text("Invalid Input.Try Again."));
                   $(".error:hidden").fadeIn("slow");
                   hasError = true;
                   return false;
               }
  
               }
          ///////////////////////////////////////////////////////////////////////////
  </code></pre>
  
  <p>Still no luck,</p>
  
  <p>also here is my html:</p>
  
  <pre><code>&lt;div&gt;
      &lt;input class="formInput" name="First Name" pattern="^[A-Za-z_-][A-Za-z0-9_-]*$" type="text"  id="frmFirst" min="2" maxlength="30"  required="required"/&gt;
      &lt;span&gt;First Name&lt;/span&gt;
  &lt;/div&gt;
  </code></pre>