title: determine if string/url belongs to particular domain
body: <p>I'm trying to use a <code>RegExp</code> in <code>JavaScript</code> to determine if the current string (which represents a URL) belongs to the <code>github.com</code> domain. </p>
  
  <p>Example, if <code>http://developer.github.com</code> or <code>http://subdomain.github.com</code> return <code>true</code>, otherwise return <code>false</code>.</p>
  
  <p>Tried using a wildcard in place of the subdomain to allow for any number of any characters between <code>http://</code> and <code>.github.com</code> .. <code>/http://[a-z]*.github.com/ig</code></p>
  
  <p><a href="http://jsfiddle.net/bobbyrne01/nrp6pkkq/1/" rel="nofollow">http://jsfiddle.net/bobbyrne01/nrp6pkkq/1/</a></p>
  
  <p><code>js</code> ..</p>
  
  <pre><code>var str0 = 'http://exämple.org/foo.html?baz=la#bumm';
  var str1 = 'https://developer.github.com/v3/';
  var str2 = 'http://developer.github.com/v3/';
  var str3 = 'http://test.github.com/v3/';
  var str4 = 'http://example.org';
  
  var patt = new RegExp("/http://[a-z]*.github.com/ig");
  document.getElementById('results').innerHTML = patt.test(str0) + '&lt;br/&gt;';
  document.getElementById('results').innerHTML += patt.test(str1) + '&lt;br/&gt;';
  document.getElementById('results').innerHTML += patt.test(str2) + '&lt;br/&gt;';
  document.getElementById('results').innerHTML += patt.test(str3) + '&lt;br/&gt;';
  document.getElementById('results').innerHTML += patt.test(str4) + '&lt;br/&gt;';
  </code></pre>
  
  <p><code>html</code> ..</p>
  
  <pre><code>&lt;div id="results"&gt;&lt;/div&gt;
  </code></pre>
  
  <p><code>output</code> ..</p>
  
  <pre><code>false
  false
  false
  false
  false
  </code></pre>
  
  <p>Expected output:</p>
  
  <pre><code>false
  false
  true
  true
  false
  </code></pre>