title: Regex to validate a url using a wildcard?
body: <p>Lets say I have a list of valid domain roots, </p>
  
  <p><code>example.com</code></p>
  
  <p><code>test.com</code></p>
  
  <p>And a variable</p>
  
  <p><code>String url</code></p>
  
  <p>How would I make use of a regex to validate that my variable url is on the list, including subdomains?</p>
  
  <p>For example, perhaps my url is <code>"subdomain.case.example.com"</code></p>
  
  <p>That is, to say clearly:</p>
  
  <p>How would I utilize a regex to verify that my url is <code>*.example.com</code> OR <code>*.test.com</code> OR <code>example.com</code> OR <code>test.com</code>?</p>