PostgreSql +从查询语句中转义 Enter 键,即在数据之间按下 Enter 键
假设我们有一个文本区域,在其中放置示例字符串。文本框包含:
Earth is revolving around the Sun.
但在保存时,我只是在“太阳”之后按了回车键。现在 texbox :: Now 中的语句
Earth is revolving around
the Sun.
我正在尝试获取数据,但由于我在字符串之间按下了回车键而无法获取数据。所以请建议我如何逃避这个回车键?
提前致谢 !!!
Suppose we have a textarea in which we put example string. Textbox contain :
Earth is revolving around the Sun.
But at the time of saving, I just pressed a enter key after "the sun". Now the statements in texbox ::
Earth is revolving around
the Sun.
Now I am trying to fetch the data but unable just because of that enter key pressed by me in between the string. So please suggest me how to escape this enter key ??
Thanks in Advance !!!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
在文本区域内按下 Enter 键,然后在 db 中输入
\r\n
。因此,通过替换这个值,我们可以用其他字母或符号对其进行转义。Enter key is pressed within the text area then
\r\n
entered in db. So by replacing this value we can escape it by an other alphabet or symbol.您只需删除 before_save 方法中的所有 Enter 键即可
You just need delete all enter key in before_save method
在 PostgreSQL 中查找 Perl 兼容的正则表达式。然后,您可以使用它来更新或选择适当的数据。
Look up Perl compatible regular expressions in PostgreSQL. You can then use this to update or select your data as approprite.