I have a column in a table that is filled with regular expressions.
I have a line in my code and I want to find out which regular expressions in this column will match this line and return these lines.
Besides extending each line and matching with a regular expression (which is expensive by checking out potentially thousands of records for a single page load), is there a way to do this in SQL instead of one (or several) queries?
Input Example: W12ABC
Sample column data
1 ^[W11][\w]+$
2 ^[W12][\w]+$
3 ^[W13][\w]+$
4 ^[W1][\w]+[A][\w]+$
5 ^[W1][\w]+[B][\w]+$
6 ^[W1][\w]+[C][\w]+$
Must return lines 2 and 4.
source
share