Re: [SQL] postgres 6.3.2 and regexp

From: Guido Piazzi <gdx(at)nemo(dot)it>
To: Bill Brandt <brandtwr-pgsql(at)draaw(dot)net>
Cc: pgsql-sql(at)hub(dot)org
Subject: Re: [SQL] postgres 6.3.2 and regexp
Date: 1999-04-19 12:54:43
Message-ID: Pine.LNX.3.96.990419124738.132B-100000@auckland.ik2gdx.ampr.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-sql

On Sun, 18 Apr 1999, Bill Brandt wrote:

> ERROR: regcomp failed with error repetition-operator operand invalid
>
> This happens anytime the text has a * as the first character.

That's because in regular expressions '*' matches zero or more consecutive
occurrences of the previous character, which can't be found when '*' is
the first character in the string. It's not like unix wildcards.

Maybe you should use 'test' instead of '*test*', because regular
expressions match every string that has the regexp in it, regardless of
what's before and after the regexp in the string.

Moreover, regular expression matching is usually done the other way round,
i.e. "SELECT * FROM table WHERE field ~ 'regexp';".

Hope it helps... Guido

--
Guido Piazzi - Piazza Crivelli, 3 - 20014 Nerviano MI - 0347 9690977
* better get into what you got to get into
better get into it now no slacking please
united nations ain't really united
and the organizations ain't really organized (Donovan, 1970)

In response to

Browse pgsql-sql by date

  From Date Subject
Next Message Dan Janowski 1999-04-19 13:26:43 Re: [SQL] OUTER JOINS
Previous Message Joe Shevland 1999-04-19 06:26:56 Re: [SQL] OUTER JOINS