[BUGS] BUG #4438: regexpression gives the error by working with [

2008-09-27 Thread Anatoli Lau

The following bug has been logged online:

Bug reference:  4438
Logged by:  Anatoli Lau
Email address:  [EMAIL PROTECTED]
PostgreSQL version: 8.3.3, 8.3.4
Operating system:   Linux Suse 10.3
Description:regexpression gives the error by working with [
Details: 

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

-- 
Sent via pgsql-bugs mailing list (pgsql-bugs@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-bugs


Re: [BUGS] BUG #4438: regexpression gives the error by working with [

2008-09-27 Thread hubert depesz lubaczewski
On Sat, Sep 27, 2008 at 12:46:31AM +, 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]*)\\]');
 regexp_matches

 {/a/b,534}
(1 row)

depesz

-- 
Linkedin: http://www.linkedin.com/in/depesz  /  blog: http://www.depesz.com/
jid/gtalk: [EMAIL PROTECTED] / aim:depeszhdl / skype:depesz_hdl / gg:6749007

-- 
Sent via pgsql-bugs mailing list (pgsql-bugs@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-bugs