psql=# \pset expanded on Expanded display is on. psql=# psql=# set standard_conforming_strings = on; SET psql=# psql=# select psql-# value, psql-# replace(value, '\r', '[CR]') as "bs", psql-# replace(value, '\\r', '[CR]') as "bsbs", psql-# replace(value, E'\r', '[CR]') as "E", psql-# regexp_replace(value, '\r', '[CR]', 'g') as "regex", psql-# regexp_replace(value, E'\r', '[CR]', 'g') as "regex E"