how to test string against regular expression contained in postgresql database field?

From: joe(at)tsolucio(dot)com (Joe Bordes)
To: pgsql-novice(at)postgresql(dot)org
Subject: how to test string against regular expression contained in postgresql database field?
Date: 2004-03-23 22:33:19
Message-ID: 9a0f19e3.0403231433.5c404584@posting.google.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-novice

Hi All,

I have a table which contains a field with regular expressions. I want
to test a given string against this field to obtain the resulting
records but I am doing something wrong and cannot find out what.

table
os_regexp os_name
------------- -----------
win.*9x windows
linux linux
etc...

select os_name from table where 'windows9x' ~ os_regexp;
ERROR: invalid regular expression: empty expression or subexpression.

Any help appreciated, Joe.

Responses

Browse pgsql-novice by date

  From Date Subject
Next Message Bill C. 2004-03-24 05:48:23 Problems getting started: createdb fails
Previous Message Richard Hayward 2004-03-23 20:54:00 Equivalent of mssql profiler?