postgresql - Postgres Query with Regex -


i'm trying create regex find (and replace) parts of strings in pg db. i'm using psql 9.0.4

i've tested regex outside of pg , works perfectly. however, isn't playing pg. if can me understand i'm doing wrong me appreciated.

regex:

{php}.*\n.*\n.*'mister_xx']\)\);.*\n} \n{\/php} 

postgres query:

select count(*) (select * "table" "column" ~ '{php}.*\n.*\n.*'mister_xx']\)\);.*\n} \n{\/php}') x; 

postgres response:

warning:  nonstandard use of escape in string literal line 1: ...m (select * "table" "column" ~ '{php}.*\n...                                                              ^ hint:  use escape string syntax escapes, e.g., e'\r\n'. error:  syntax error @ or near "mister_xx" line 1: ..."table" "column" ~ '{php}.*\n.*\n.*'mister_x... 

in sql, quotes delimited 2 quotes, example:

'child''s play' 

applying regex makes work:

select count(*) "table" "column" ~ '{php}.*\n.*\n.*''mister_xx'']\)\);.*\n} \n{\/php}' x; 

note how redundant subquery .


Comments

Popular posts from this blog

blackberry 10 - how to add multiple markers on the google map just by url? -

php - guestbook returning database data to flash -

delphi - Dynamic file type icon -