Re: Checking regex pattern validity

From: David Garamond <lists(at)zara(dot)6(dot)isreserved(dot)com>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, pgsql-general(at)postgresql(dot)org
Subject: Re: Checking regex pattern validity
Date: 2004-09-16 13:31:42
Message-ID: 414995BE.4050803@zara.6.isreserved.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Tom Lane wrote:
> David Garamond <lists(at)zara(dot)6(dot)isreserved(dot)com> writes:
>
>>Is there a function like IS_VALID_REGEX() to check whether a pattern is
>>valid (i.e. it compiles)? I'm storing a list of regex patterns in a
>>table. It would be nice to be able to add a CHECK constraint to ensure
>>that all the regexes are valid.
>
> ... CHECK (('' ~ pattern) IS NOT NULL) ...

Not exactly what I wanted, but close enough. Thanks!

However, what if only want to accept invalid regex patterns? Or what if
invalid pattern should be converted to NULL automatically? I'd still
vote for a function...

--
dave

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Bill Moran 2004-09-16 13:47:34 Re: Postgresql <--> webservices?
Previous Message ruben20@superguai.com 2004-09-16 12:58:14 Postgres memory usage