title: URL Validation REGEX - URL just valid with http://
body: <p><strong>How it works</strong></p>
  
  <p>I have an input field to enter the URL of a Website and i wanna check it and if the URL is OK i will give the inputfield a class("validated_ok") and remove a class ("cf_required") and if its wrong the other way around.</p>
  
  <p><strong>Problem</strong></p>
  
  <p>The url should just be right if it is written with <code>http://</code> but actually its also right with just <code>www</code> (<code>www.google.ch</code>). How i have to change the regex? </p>
  
  <p><strong>Javascript</strong></p>
  
  <pre><code>// CHECK WEBSITE
  $(".cf_required[name='website']").focusout(function() {
      var myVariable = $(this).val();
      if(/^(http:\/\/www\.|https:\/\/www\.|http:\/\/|https:\/\/|www\.)[a-z0-9]+([\-\.]{1}[a-z0-9]+)*\.[a-z]{2,5}(:[0-9]{1,5})?(\/.*)?$/.test(myVariable)){
          $(this).addClass("validated_ok").removeClass("cf_required")
      } else {
          $(this).removeClass("validated_ok").addClass("cf_required");
      }
  });
  </code></pre>