Postgres 中 LIKE 和 ~ 的区别 [英] Difference between LIKE and ~ in Postgres

查看:36
本文介绍了Postgres 中 LIKE 和 ~ 的区别的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我被指示不要用 LIKE",而是使用 ~.LIKE 有什么问题,~ 有什么不同?

I've been instructed "not to bother with LIKE" and use ~ instead. What is wrong with LIKE and how is ~ different?

~ 在此上下文中是否有名称,或者人们是否说使用波浪号运算符"?

Does ~ have a name in this context or do people say "use the tilde operator"?

推荐答案

~ 是正则表达式运算符,并具有由此暗示的功能.您可以指定完整范围的正则表达式通配符和量词;有关详细信息,请参阅文档.它当然比 LIKE 更强大,应该在需要这种能力时使用,但它们有不同的用途.

~ is the regular expression operator, and has the capabilities implied by that. You can specify a full range of regular expression wildcards and quantifiers; see the documentation for details. It is certainly more powerful than LIKE, and should be used when that power is needed, but they serve different purposes.

这篇关于Postgres 中 LIKE 和 ~ 的区别的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆