title: Regex String Doesn't Start or End With Special Character
body: <p>SO buddies, greetings.  I have some password requirements I need to implement and one of the requirements is the string <strong>cannot start or end with a special character</strong>.  I did spend some time Googling around but my RegEx kung-fu is kimosabe level.</p>
  
  <p>Just in case you're interested in some code, here's the <strong>JavaScript</strong>:<br>
  <em>Note: Yes, passwords are also validated on the server as well :)  The following snippet runs the RegEx tests and simply checks or x's the row item associated with the password rule.</em></p>
  
  <pre><code>var validate = function(password){
          valid = true;
  
          var validation = [
              RegExp(/[a-z]/).test(password), RegExp(/[A-Z]/).test(password), RegExp(/\d/).test(password), 
              RegExp(/[-!#$%^&amp;*()_+|~=`{}\[\]:";'&lt;&gt;?,./]/).test(password), !RegExp(/\s/).test(password), !RegExp("12345678").test(password), 
              !RegExp($('#txtUsername').val()).test(password), !RegExp("cisco").test(password), 
              !RegExp(/([a-z]|[0-9])\1\1\1/).test(password), (password.length &gt; 7)
          ]
  
          $.each(validation, function(i){
              if(this == true)
                  $('.form table tr').eq(i+1).attr('class', 'check');
              else{
                  $('.form table tr').eq(i+1).attr('class', '');
                  valid = false
              }
          });
  
          return(valid);
  
      }
  </code></pre>