Re: Regular expression question

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Steve Heaven <steve(at)thornet(dot)co(dot)uk>
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: Regular expression question
Date: 2000-12-11 15:30:07
Message-ID: 7216.976548607@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general pgsql-hackers

Steve Heaven <steve(at)thornet(dot)co(dot)uk> writes:
> Does the regular expression parser have anything equivalent to Perl's \w
> word boundary metacharacter?

src/backend/regex/re_format.7 contains the whole scoop (for some reason
this page doesn't seem to get installed with the rest of the
documentation). In particular:

There are two special cases of bracket expressions:
the bracket expressions `[[:<:]]' and `[[:>:]]' match the null
string at the beginning and end of a word respectively.
A word is defined as a sequence of word characters
which is neither preceded nor followed by word characters.
A word character is an alnum character (as defined by ctype(3))
or an underscore. This is an extension, compatible with but not
specified by POSIX 1003.2, and should be used with caution in
software intended to be portable to other systems.

...

BUGS

The syntax for word boundaries is incredibly ugly.

POSIX bracket expressions are pretty ugly anyway, and this is no worse
than the rest. However, if you prefer Perl or Tcl, I'd recommend that
you just *use* Perl or Tcl ;-). plperl and pltcl make great
implementation languages for text-mashing functions...

regards, tom lane

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Tom Lane 2000-12-11 15:32:58 Re: [HACKERS] AW: Oracle-compatible lpad/rpad behavior
Previous Message Matthew 2000-12-11 15:29:34 Re: Re: Why PostgreSQL is not that popular as MySQL ?

Browse pgsql-hackers by date

  From Date Subject
Next Message Tom Lane 2000-12-11 15:32:58 Re: [HACKERS] AW: Oracle-compatible lpad/rpad behavior
Previous Message Zeugswetter Andreas SB 2000-12-11 15:09:03 suggest remove of elog in xlog.c