Firestore 安全规则、正则表达式、如何避免特殊字符

时间:2021-06-21 06:50:45

标签: firebase google-cloud-firestore firebase-security

https://firebase.google.com/docs/reference/security/database/regex

我现在正在看这个,感觉有点难以理解和棘手

我只想设置正则表达式“只允许使用较低的字母和数字以及 - _ * # . 这五个特殊字符。

我怎么能做到这一点?谢谢

1 个答案:

答案 0 :(得分:2)

如果您使用 Cloud Firestore,则应根据 Google RE2 syntax 声明正则表达式,请参阅有关 matches() 方法的文档。

您在问题中提到的链接是关于实时数据库安全规则的。实时数据库和 Cloud Firestore 是两种不同的 NoSQL 数据库服务,具有不同的安全规则语法。