我的文件看起来像这样。
{
"sId": "s1",
"source": "September Challenge 1"
},
{
"sId": "s2",
"source": "other string multi word"
},
{
"sId": "s3",
"source": "September sub string to filter Challenge"
}
我试图只查找没有子字符串“substring to filter“的文档。预期结果是:
{
"sId": "s1",
"source": "September Challenge 1"
},
{
"sId": "s2",
"source": "other string multi word"
},
我应该使用哪个regexp?
我尝试了不同的正则表达式,但没有达到预期的结果。我看到了Exclude string from MongoDB regex,但我没能根据我的情况调整答案。
1条答案
按热度按时间8dtrkrch1#
RegExp-only解决方案是:
实际上,问题与Regular expression to match a line that doesn't contain a word相同