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

Re: how to test string against regular expression contained

From: Stephan Szabo <sszabo(at)megazone(dot)bigpanda(dot)com>
To: Joe Bordes <joe(at)tsolucio(dot)com>
Cc: pgsql-novice(at)postgresql(dot)org
Subject: Re: how to test string against regular expression contained
Date: 2004-03-26 19:40:02
Message-ID: 20040326113848.U74284@megazone.bigpanda.com (view raw or flat)
Thread:
Lists: pgsql-novice
On Thu, 25 Mar 2004, Joe Bordes wrote:

> CoL <col(at)mportal(dot)hu> wrote in message news:<c3s060$1k0m$1(at)news(dot)hub(dot)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?

In response to

pgsql-novice by date

Next:From: Bruno Wolff IIIDate: 2004-03-26 20:18:20
Subject: Re: Extract Function
Previous:From: Tom LaneDate: 2004-03-26 19:33:27
Subject: Re: how to test string against regular expression contained in postgresql database field?

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