微信公众号搜"智元新知"关注
微信扫一扫可直接关注哦!

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

原文地址:https://www.jb51.cc/postgresql/193557.html

版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。

相关推荐