Thread: Writing regex in PL's

Writing regex in PL's

From
David Garamond
Date:
Is there anyone on this list who has preferred to use regexes from PL's
(e.g. plperl, plruby) in CHECK constraints or other places instead of
the flavor provided by Postgres? Do you find your approach satisfying?
Do you also do things like cache the pattern so you don't have to
compile the regex on every function invocation?

I'm also about to choose this route, mainly because I want to separate
the patterns into a Ruby module and would rather have one regex flavor
(and I can never remember all that POSIX stuffs anyway :-).

--
dave


Re: Writing regex in PL's

From
"Scott Marlowe"
Date:
On Sat, 2004-08-07 at 14:40, David Garamond wrote:
> Is there anyone on this list who has preferred to use regexes from PL's
> (e.g. plperl, plruby) in CHECK constraints or other places instead of
> the flavor provided by Postgres? Do you find your approach satisfying?
> Do you also do things like cache the pattern so you don't have to
> compile the regex on every function invocation?
>
> I'm also about to choose this route, mainly because I want to separate
> the patterns into a Ruby module and would rather have one regex flavor
> (and I can never remember all that POSIX stuffs anyway :-).

I've never used plperl for regex, and I'm pretty comfy with posix regex,
as long as it's simple.  Let's face it, perl regex is king for a reason,
and it ain't cause they're easy to read.

Now, SQL regex, that gives me a headache.