Skip to content

Instantly share code, notes, and snippets.

@zEvg
Created April 23, 2012 09:55
Show Gist options
  • Save zEvg/2469949 to your computer and use it in GitHub Desktop.
Save zEvg/2469949 to your computer and use it in GitHub Desktop.
Table of regexps [MySql]
INSERT INTO `regexp_table` (`id`, `name`, `regexp`)
VALUES
(1,'first','pi|apa'),
(2,'second','^(pi|apa)$'),
(3,'third','^(pi)*$'),
(4,'fourth','^Ba?n');
select * from regexp_table;
select T.name, T.`regexp`
from regexp_table T
where (select 'pi' REGEXP T.`regexp`) = 1;
RESULT:
first pi|apa
second ^(pi|apa)$
third ^(pi)*$
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment