title: Regular Expression for URL that matches home/index page
body: <p>I'm trying to come up with a regular expression that will indicate if the URL provided is the index page of the site. This means it has to match <code>example.com</code>, <code>example.com/</code> and <code>example.com/index.php</code> but not <code>example.com/page.php</code></p>
  <p>Here's a list that I came up with for testing. So many permutations due to www/non-www, http/https, trailing slashes, etc.</p>
  <p>It should match these:</p>
  <ul>
  <li><code>http://example.com/index.php</code></li>
  <li><code>http://example.com/</code></li>
  <li><code>http://example.com</code></li>
  <li><code>http://example.com/index.php?var=X</code></li>
  <li><code>http://example.com/?var=X</code></li>
  <li><code>http://example.com?var=X</code></li>
  <li><code>https://example.com/index.php</code></li>
  <li><code>https://example.com/</code></li>
  <li><code>https://example.com</code></li>
  <li><code>https://example.com/index.php?var=X</code></li>
  <li><code>https://example.com/?var=X</code></li>
  <li><code>https://example.com?var=X</code></li>
  <li><code>http://www.example.com/index.php</code></li>
  <li><code>http://www.example.com/</code></li>
  <li><code>http://www.example.com</code></li>
  <li><code>http://www.example.com/index.php?var=X</code></li>
  <li><code>http://www.example.com/?var=X</code></li>
  <li><code>http://www.example.com?var=X</code></li>
  <li><code>https://www.example.com/index.php</code></li>
  <li><code>https://www.example.com/</code></li>
  <li><code>https://www.example.com</code></li>
  <li><code>https://www.example.com/index.php?var=X</code></li>
  <li><code>https://www.example.com/?var=X</code></li>
  <li><code>https://www.example.com?var=X</code></li>
  </ul>
  <p>It should NOT match these</p>
  <ul>
  <li><code>http://example.com/page.php</code></li>
  <li><code>http://example.com/page.php?var=X</code></li>
  <li><code>http://example.com/page</code></li>
  <li><code>http://example.com/page/</code></li>
  <li><code>http://example.com/page/index.php</code></li>
  <li><code>http://example.com/page?var=X</code></li>
  <li><code>http://example.com/page/?var=X</code></li>
  <li><code>https://example.com/page.php</code></li>
  <li><code>https://example.com/page.php?var=X</code></li>
  <li><code>https://example.com/page</code></li>
  <li><code>https://example.com/page/</code></li>
  <li><code>https://example.com/page/index.php</code></li>
  <li><code>https://example.com/page?var=X</code></li>
  <li><code>https://example.com/page/?var=X</code></li>
  <li><code>http://www.example.com/page.php</code></li>
  <li><code>http://www.example.com/page.php?var=X</code></li>
  <li><code>http://www.example.com/page</code></li>
  <li><code>http://www.example.com/page/</code></li>
  <li><code>http://www.example.com/page/index.php</code></li>
  <li><code>http://www.example.com/page?var=X</code></li>
  <li><code>http://www.example.com/page/?var=X</code></li>
  <li><code>https://www.example.com/page.php</code></li>
  <li><code>https://www.example.com/page.php?var=X</code></li>
  <li><code>https://www.example.com/page</code></li>
  <li><code>https://www.example.com/page/</code></li>
  <li><code>https://www.example.com/page/index.php</code></li>
  <li><code>https://www.example.com/page?var=X</code></li>
  <li><code>https://www.example.com/page/?var=X</code></li>
  </ul>
  <p>(Are there any other combinations I left out?)</p>
  <p>All I've come up with so far is:</p>
  <p><code>example.com(/|index.php|)</code></p>
  <p>which is obviously incorrect as it is matching the <code>/page</code> values too.</p>