title: How to count URL domains in MySQL?
body: <p>I have a MySQL table with a column of well-formed URLs. I'd like to get a table of the unique domain names in the column, and the number of times each domain appears. Is there a MySQL query that can do this?</p>
  
  <p>I thought of doing something like...</p>
  
  <pre><code>SELECT COUNT(*)
  FROM log
  GROUP BY url REGEXP "/* regexp here */"
  </code></pre>
  
  <p>...but this doesn't work as REGEXP returns 0 or 1 and not what was matched.</p>