Skip site navigation (1) Skip section navigation (2)

Re: BUG #4438: regexpression gives the error by workingwith [

From: hubert depesz lubaczewski <depesz(at)depesz(dot)com>
To: Anatoli Lau <ailau(at)sharematrix(dot)com>
Cc: pgsql-bugs(at)postgresql(dot)org
Subject: Re: BUG #4438: regexpression gives the error by workingwith [
Date: 2008-09-27 07:55:58
Message-ID: (view raw, whole thread or download thread mbox)
Lists: pgsql-bugs
On Sat, Sep 27, 2008 at 12:46:31AM +0000, Anatoli Lau wrote:
> select regexp_matches('/a/b[534]', E'(.*)\[([0-9]*)\]');
> always gives the error but
> select regexp_matches('/a/b{534}', E'(.*)\{([0-9]*)\}');
> works good, the problems comes up only when '[' used

it would be good to show what kind of error it shows. i can only guess
that you are running it through psql, and the error you get is:
ERROR:  invalid regular expression: parentheses () not balanced

in such case, change "\[" to "\\[":
# select regexp_matches('/a/b[534]', E'(.*)\\[([0-9]*)\\]');
(1 row)


Linkedin:  /  blog:
jid/gtalk: depesz(at)depesz(dot)com / aim:depeszhdl / skype:depesz_hdl / gg:6749007

In response to

pgsql-bugs by date

Next:From: austijcDate: 2008-09-28 18:51:49
Subject: Re: ERROR: unexpected data beyond EOF in block XXXXX of relation "file"
Previous:From: Anatoli LauDate: 2008-09-27 00:46:31
Subject: BUG #4438: regexpression gives the error by working with [

Privacy Policy | About PostgreSQL
Copyright © 1996-2017 The PostgreSQL Global Development Group