regex – 如何清除回车和Postgresql中的新行?

所有,

我再次卡住了,试图获得我需要它的格式我的数据。我有一个文本字段,看起来像这样。

“deangelo 001 deangelo

local origin of name: italain

from the american name deangelo

meaning: of the angels

emotional spectrum • he is a fountain of joy for all.

personal integrity • his good name is his most precIoUs asset.
personality • it’s hard to soar with eagles when you’re surrounded by
turkeys! relationships • starts slowly,but a relationship with
deangelo builds over time. travel & leisure • a trip of a lifetime
is in his future.

career & money • a gifted child,deangelo will need to be
challenged constantly.

life’s opportunities • joy and happiness await this blessed person.

deangelo’s lucky numbers: 12 • 38 • 18 • 34 • 29 • 16

最好的办法是在Postgresql删除回车和换行符?我试过几件事情,没有人想表现。

select regexp_replace(field,E'\r\c','  ','g') from mytable
    WHERE id = 5520805582

SELECT regexp_replace(field,E'[^\(\)\&\/,;\*\:.\>\<[:space:]a-zA-Z0-9-]',' ')
    FROM mytable
    WHERE field~ E'[^\(\)\&\/,;\*\:.\<\>[:space:]a-zA-Z0-9-]'
    AND id = 5520805582;

提前致谢,
亚当

select regexp_replace(field,E'[\\n\\r]+',' ','g' )

阅读手册http://www.postgresql.org/docs/current/static/functions-matching.html

相关文章

项目需要,有个数据需要导入,拿到手一开始以为是mysql,结果...
本文小编为大家详细介绍“怎么查看PostgreSQL数据库中所有表...
错误现象问题原因这是在远程连接时pg_hba.conf文件没有配置正...
因本地资源有限,在公共测试环境搭建了PGsql环境,从数据库本...
wamp 环境 这个提示就是说你的版本低于10了。 先打印ph...
psycopg2.OperationalError: SSL SYSCALL error: EOF detect...