Re: how to test string against regular expression contained - Mailing list pgsql-novice

From Stephan Szabo
Subject Re: how to test string against regular expression contained
Date
Msg-id 20040326113848.U74284@megazone.bigpanda.com
Whole thread Raw
In response to Re: how to test string against regular expression contained in postgresql database field?  (joe@tsolucio.com (Joe Bordes))
List pgsql-novice
On Thu, 25 Mar 2004, Joe Bordes wrote:

> CoL <col@mportal.hu> wrote in message news:<c3s060$1k0m$1@news.hub.org>...
> >
> > create a function for that.
> >
> > create or replace function osregexp(varchar,varchar) returns boolean as
> > ' select $1 ~ $2; 'language sql immutable;
> >
> > SELECT osregexp('windows9x','win.*9x');
> >   osregexp
> > ----------
> >   t
> >
> > C.
>
> Hi,
>
> First thanks for answering.
>
> This gives me the same error. I have created the function as you say
> and it works when called directly with strings (as above) but not when
> called with a table field.
>
> select os_name from table where osregexp('windows9x',os_regexp);
> ERROR: invalid regular expression: empty expression or subexpression

Do you have any strings where the above error might be true?  For example
an empty string or something containing () or other such special values?

pgsql-novice by date:

Previous
From: Bruno Wolff III
Date:
Subject: Re: Extract Function
Next
From: Tom Lane
Date:
Subject: Re: how to test string against regular expression contained in postgresql database field?