mongodb中单引号的正则表达式 [英] regular expression for single quote mark in mongodb
本文介绍了mongodb中单引号的正则表达式的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
在mongodb shell客户端中, 如何查询查找带单引号的文档? 我逃脱了正则表达式中的引号. 但这不起作用.
in mongodb shell client, how can I query to find documents with single quotes? I escaped the quote mark in regex. but it does not work.
db.coll.find({field: /\'/})
推荐答案
这应该有效:
db.coll.find({field: /\x27/});
0x27是 Unicode撇号
来自文档:
MongoDB正则表达式查询在正则表达式字符串中支持UTF-8.
MongoDB regex queries support UTF-8 in the regex string.
这篇关于mongodb中单引号的正则表达式的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文