Re: [SQL] postgres 6.3.2 and regexp - Mailing list pgsql-sql

From Guido Piazzi
Subject Re: [SQL] postgres 6.3.2 and regexp
Date
Msg-id Pine.LNX.3.96.990419124738.132B-100000@auckland.ik2gdx.ampr.org
Whole thread Raw
In response to postgres 6.3.2 and regexp  (Bill Brandt <brandtwr-pgsql@draaw.net>)
List 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
andthe organizations ain't really organized  (Donovan, 1970)
 





pgsql-sql by date:

Previous
From: "D'Arcy" "J.M." Cain
Date:
Subject: Re: [SQL] Case insensitive searchs
Next
From: "Brett W. McCoy"
Date:
Subject: VACUUM in a trigger