title: How to use REGEXP in SQLite3 to extract matched string (as a column value)
body: <p>Is there a way to use REGEXP to return not just whether or not there was a match (i.e. <code>1</code> or <code>0</code>), but the actual match itself. For example, if I have a column of URLs and I want to extract the matched portion of a URL (e.g. the domain): </p>
  
  <pre><code>SELECT url REGEXP '\w+\.com' AS domain
  FROM urls
  GROUP by domain;
  </code></pre>
  
  <p>Not sure if there are differences between REGEXP extensions, but FWIW, I'm using the one found in <a href="https://github.com/sqlitebrowser/sqlitebrowser/wiki/Regular-Expressions" rel="nofollow">DB Browser for SQLite</a></p>