Combine query with regex in SQL?

I am trying to find a way to match a query with a regular expression in a database. As far as I can tell (although I'm not an expert), while most DBMSs such as MySQL have a regex parameter for searching, you can do something like:

Find all the rows in column 1 matching the regular expression in my query.

What I want to do is the opposite, i.e.:

Find all rows in column 1 so that the regular expression in column 1 matches my query.

A simple example - let's say I had a database structured like this:

+----------+-----------+  
| Column 1 |  Column 2 |
+----------+-----------+
|  [a-z]+  |  whatever |
+----------+-----------+
|  [\w]+   |  whatever |
+----------+-----------+
|  [0-9]+  |  whatever |
+----------+-----------+

, "" , , [az] + [\ w] +, 123, [0-9] +.

SQL, SELECT .

+5
2

MySQL ( ):

SELECT * FROM table WHERE "dog" RLIKE(`Column 1`)
+4

PostgreSQL :

SELECT * FROM table WHERE 'dog' ~ "Column 1";
+1

All Articles