title: javascript Reg Exp to match specific domain name
body: <p>I have been trying to make a Reg Exp to match the URL with specific domain name.</p>
  
  <p>So if i want to check if this url is from example.com
  what reg exp should be the best?</p>
  
  <p>This reg exp should match following type of URLs:</p>
  
  <pre><code>http://api.example.com/...
  http://preview.example.com/...
  http://www.example.com/...
  http://purhcase.example.com/...
  </code></pre>
  
  <p>Just simple rule, like <code>http://{something}.example.com/{something}</code> then should pass.</p>
  
  <p>Thank you.</p>