Re: PL/TCL regex string matching

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: "Robert B(dot) Easter" <reaster(at)comptechnews(dot)com>
Cc: Marcin Mazurek <M(dot)Mazurek(at)poznan(dot)multinet(dot)pl>, pgsql-general(at)postgresql(dot)org
Subject: Re: PL/TCL regex string matching
Date: 2000-11-20 18:17:52
Message-ID: 28499.974744272@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

"Robert B. Easter" <reaster(at)comptechnews(dot)com> writes:
> These links might be useful:
> http://www.postgresql.org/docs/aw_pgsql_book/node52.html
> http://www.scriptics.com/man/tcl8.4/TclCmd/regexp.htm

> Pg uses '~' as the regexp operator, so you can try that instead of the '='.

Pg's regexp package is pretty old and limited --- I believe it just
implements some POSIX spec or other, not all the fancy stuff you find
in TCL or Perl regexps nowadays.

If you need some non-POSIX regexp feature, try making a TCL regexp
function, say

create function tcl_regexp(text,text) returns bool as
'regexp -- $1 $2' language 'pltcl';

Then you use this in SQL queries like

SELECT ... WHERE tcl_regexp('pattern', variable);

In general, pltcl or plperl make great implementation languages for
text-mashing functions, so I don't feel any big hurry to improve
our built-in SQL functions to try to equal them...

regards, tom lane

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Richard Huxton 2000-11-20 18:20:31 Re: Cannot create users
Previous Message Robert B. Easter 2000-11-20 17:54:04 Re: PL/TCL regex string matching