是否可以检查字符串中的字母?假设我在这里有一个实体:
[
{
_id: "1",
"foo": "AD3495H2D23G"
}
]有没有办法弄清楚foo是由任何字母组成还是由特定字母组成。假设D和H,如果它们存在,过滤掉实体。
发布于 2018-08-01 20:16:37
这可以使用这个string to characters trick来解决。
{
"_id": "letter-filtering",
"type": "pipe",
"source": {
"type": "embedded",
"entities": [{
"_id": "1",
"foo": "AZ3495DX223G"
}]
},
"transform": {
"type": "dtl",
"rules": {
"default": [
["filter",
["not",
["intersects",
["list", "D", "H"],
["map",
["substring", "_.",
["plus", "_.", 1], "_S.foo"],
["range", 0,
["length", "_S.foo"]
]
]
]
]
]
]
}
}
}只要D或H在foo prop中,这就会过滤掉实体。
https://stackoverflow.com/questions/51632528
复制相似问题