I have a SQLite table called comments
with a column called text
. I've been trying to make a SQL query that selects all rows where text
fulfills the following regular expression: (^|\\W)TEST(\\W|$)
. Currently, I'm using python to select all rows with TEST
, then, running the regex test for each row that is returned. However, speed matters in what I'm doing, and it would be much faster if the SQL query had the regex matching. Here is the current query I have:
SELECT text FROM comments WHERE text LIKE "%TEST%"
How can I use regex in an SQLite query? If not regex, does SQLite have some similarly powerful text-matching syntax?
I'm on Windows 10.