The following bug has been logged online:
Bug reference:      5257
Logged by:          Roman Kononov
Email address:      kononov@ftml.net
PostgreSQL version: 8.4.2
Operating system:   GNU/Linux x86_64
Description:        wrong results of SUBSTRING with SQL regular expressions
Details:
test=# select substring('34' from '(2|3)#"4#"' for '#');
 substring
-----------
 3
(1 row)
test=# select substring('^' from '#"^#"' for '#');
 substring
-----------
(1 row)
test=# select substring('$' from '#"$#"' for '#');
 substring
-----------
(1 row)
These look wrong according to the PG documentation.