Google cloud firestore firestore.rules正则表达式中的计算错误

Google cloud firestore firestore.rules正则表达式中的计算错误,google-cloud-firestore,firebase-security,re2,Google Cloud Firestore,Firebase Security,Re2,我试图匹配任何字母的标签字符串 我已经在多个re2测试站点上测试了^{1}\p{L}+$,它们都工作正常,但在firestore.rules中,我得到一个编译错误: Error: Compilation errors in firestore.rules: [E] 33:33 - Unexpected 'p'. [E] 33:37 - Unexpected '+'. [E] 36:1 - Unexpected '}'. 删除\p{L}可以消除错误,但就我所见,这应该是有效的 我的测试字符串(前

我试图匹配任何字母的标签字符串

我已经在多个re2测试站点上测试了
^{1}\p{L}+$
,它们都工作正常,但在firestore.rules中,我得到一个编译错误:

Error: Compilation errors in firestore.rules:
[E] 33:33 - Unexpected 'p'.
[E] 33:37 - Unexpected '+'.
[E] 36:1 - Unexpected '}'.
删除
\p{L}
可以消除错误,但就我所见,这应该是有效的

我的测试字符串(前3个应该匹配,其余的不应该匹配)

编辑: 这里有规则

match /tags/{tagId} {
  allow create: if userIs(userId) && isValidTag(tagId)
  allow read: if userIs(userId)
}


function isValidTag(tag) {
  return tag.matches('^#{1}\p{L}+$') == true
}

尝试用另一个反斜杠转义反斜杠:

return tag.matches('^#{1}\\p{L}+$') == true

尝试用另一个反斜杠转义反斜杠:

return tag.matches('^#{1}\\p{L}+$') == true

请编辑问题,以显示您正在使用的实际规则,这些规则与您预期的工作方式不同。这些规则刚刚更改that@DougStevenson我很想听到你的回音!始终重视您的输入:)请编辑问题以显示您正在使用的实际规则,这些规则与您预期的工作方式不符。这些规则刚刚更改that@DougStevenson我很想听到你的回音!始终重视您的输入:)