regex - Matching with a regular expression in a string in PostgreSQL -


i trying not sure possible or not.

so here is, have 1 data set in postgresql table:

select * company;   id |     name         | age |  ----+------------------+-----+-   2 | spine_[1-9]_leaf |  12 |   

so storing regular expression in name in database. means if pass in query value spine_1_leaf ... spine_9_leaf, should return record:

  2 | spine_[1-9]_leaf |  12 | 

because name string matches name (regex db). please let me know how can make possible. trying things like:

select * company name ~ 'spine_1_leaf' 

which not working (and should not also).

you've got search string , term wrong way round:

select * company 'spine_1_leaf' ~ name 

is you're after.


Comments

Popular posts from this blog

Magento/PHP - Get phones on all members in a customer group -

php - Bypass Geo Redirect for specific directories -

php - .htaccess mod_rewrite for dynamic url which has domain names -