Firebase match()不能与正则表达式一起使用

时间:2017-04-20 14:38:08

标签: regex firebase firebase-realtime-database firebase-security

我想在我的firebase验证规则中实现此正则表达式https://regex101.com/r/9m7vMC/1/(它检查坐标纬度)。这是我的代码:

"coordinate": {
    "latitude": {
        ".validate": "newData.isString() && newData.val().matches(/^(\\+|-)?(?:90(?:(?:\\.0{1,6})?)|(?:[0-9]|[1-8][0-9])(?:(?:\\.[0-9]{1,6})?))$/)"
    }
}

我已经转发+.,因此有双反斜杠\\+\\.

但是这段代码不起作用。当我尝试写出正确的纬度时,我收到了错误FIREBASE WARNING: update at / failed: permission_denied

0 个答案:

没有答案