Re: question about reg. expression

From: Kenneth Marshall <ktm(at)rice(dot)edu>
To: Stephen Belcher <sycobuny(at)malkier(dot)net>
Cc: Samuel Gendler <sgendler(at)ideasculptor(dot)com>, andrew1 <andrew1(at)mytrashmail(dot)com>, pgsql-sql(at)postgresql(dot)org
Subject: Re: question about reg. expression
Date: 2011-01-19 14:18:38
Message-ID: 20110119141838.GJ6475@aart.is.rice.edu
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-sql

On Wed, Jan 19, 2011 at 08:17:50AM -0500, Stephen Belcher wrote:
> Another way to match multiple occurrences is to use curly brackets with a
> number, like:
> select 'ab' ~ '^[a-z]{2}$';
>
> It can be done with a range of numbers as well:
> select 'ab' ~ '^[a-z]{2,4}$';
> select 'abab' ~ '^[a-z]{2,4}$';
>
> I believe, however, that the curly brackets notation was introduced in 9.0
> and is not available in earlier versions.
>
> --Stephen
>

That is not so. POSIX regular expressions, including the curly backet
notation, are available in all current supported releases of PostgreSQL:

http://www.postgresql.org/docs/8.2/static/functions-matching.html#FUNCTIONS-POSIX-REGEXP

I did not bother to check our local documentation for earlier releases
as to how much earlier such support was available.

Cheers,
Ken

In response to

Browse pgsql-sql by date

  From Date Subject
Next Message Carla 2011-01-19 20:11:01 Re: Getting top 2 by Category
Previous Message Stephen Belcher 2011-01-19 13:17:50 Re: question about reg. expression