1

Is there a way to use REGEXP to return not just whether or not there was a match (i.e. 1 or 0), 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):

SELECT url REGEXP '\w+\.com' AS domain
FROM urls
GROUP by domain;

Not sure if there are differences between REGEXP extensions, but FWIW, I'm using the one found in DB Browser for SQLite

dancow
  • 3,228
  • 2
  • 26
  • 28

1 Answers1

2

The REGEXP operator returns just a boolean value, whether the text matches or not.

If you want to get more information, you have to write some other function.

CL.
  • 173,858
  • 17
  • 217
  • 259
  • Accepting this as the answer, as I haven't found any other (official) alternative, and the REGEXP operator is as you say. Thanks! – dancow Aug 24 '16 at 11:19