Skip site navigation (1) Skip section navigation (2)

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 (view raw or flat)
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

pgsql-novice by date

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

Privacy Policy | About PostgreSQL
Copyright © 1996-2014 The PostgreSQL Global Development Group