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

前端之家收集整理的这篇文章主要介绍了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

猜你在找的Postgre SQL相关文章