Re: postgresql regular expr bug?

From: hubert depesz lubaczewski <depesz(at)depesz(dot)com>
To: Pavel Stehule <pavel(dot)stehule(at)gmail(dot)com>
Cc: PostgreSQL Hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: postgresql regular expr bug?
Date: 2009-06-14 07:25:50
Message-ID: 20090614072550.GA29058@depesz.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Sun, Jun 14, 2009 at 08:15:55AM +0200, Pavel Stehule wrote:
> postgres=# select '10' ~ '[0..9]+$';
> ?column?
> ----------
> t
> (1 row)

regexp '[0..9]+$' tests is given strings containst at the end substring
containing only characters "0", "9" and ".".
and yes, it does - the last character is 0, so it matches.

> postgres=# select '10' ~ '^[0..9]+$';
> ?column?
> ----------
> f
> (1 row)

this regexp checks if whole string is built only with characters "0",
"9", and ".". and it is not - the first character is "1" which is not
the character list you provided.

basically ".." has no special meaning in regexps, especially within [] -
i.e. it is just a dot.

Best regards,

depesz

--
Linkedin: http://www.linkedin.com/in/depesz / blog: http://www.depesz.com/
jid/gtalk: depesz(at)depesz(dot)com / aim:depeszhdl / skype:depesz_hdl / gg:6749007

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Pavel Stehule 2009-06-14 07:35:33 Re: postgresql regular expr bug?
Previous Message Stephen J. Butler 2009-06-14 06:28:02 Re: postgresql regular expr bug?