title: How should i adjust regex for validate url to accept #?
body: <p>I have this regex to validate a url:</p>
  
  <pre><code> $scope.validUrl = function(str){
              var pattern = new RegExp('^(https?:\\/\\/)?'+ // protocol
              '((([a-z\\d]([a-z\\d-]*[a-z\\d])*)\\.)+[a-z]{2,}|'+ // domain name
              '((\\d{1,3}\\.){3}\\d{1,3}))'+ // OR ip (v4) address
              '(\\:\\d+)?(\\/[-a-z\\d%_.~+]*)*'+ // port and path
              '(\\?[;&amp;a-z\\d%_.~+=-]*)?'+ // query string
              '(\\#[-a-z\\d_]*)?$','i'); // fragment locator
              if(!pattern.test(str)) {
                  return false;
              } else {
                  return true;
              }
          };
  </code></pre>
  
  <p>and i want to validate this url with it:</p>
  
  <pre><code>http://coding-academy.org/#/contact
  </code></pre>
  
  <p>if i apply this url to the function, returns false,</p>
  
  <p>Problem is the #, How should i make this work?</p>