Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

189
Visualizações
How to allow emoji in Firestore rules, but disallow certain other special characters

I'm working on rules for a project. This project is an App developed with React-Native and the react-native-firebase library.

I already placed the main role-based rules and they work as expected.

I'm struggling when i work with string validation. I'm trying to allow emojis using the matches() function from the firestore rules and so far i don't have the right solution.

Here is my code :

function ValidateUser(user) {
return (
///////

user.Description is string && 
user.Description.matches("[a-zA-Z0-9_ /some more characters/]+") 

///////
) 
}

The issue here is that I'm blocking any other characters which include unicode and emojis as well.

I found some solutions online like adding this to my regex :

\u00a9|\u00ae|[\u2000-\u3300]|\ud83c[\ud000-\udfff]|\ud83d[\ud000-\udfff]|\ud83e[\ud000-\udfff]

Or even something like this :

\x00-\x7F or this one \xFFFF

None of them seems to work within the firestore rules.

So i tried to work the other way around and instead of allowing the characters i want, i tried to exclude those i don't want like so :

user.Description is string &&
user.Description.matches("[/unwanted special characters/]+") == false

It should allow an user to write only if this is false if none of this characters matches within the string. But for some reason it only works when there is only those characters in the string...

For example :

&#/ this won't allow the user to write

Hello&#/ this will allow the user to write while it shouldn't for my use-case.

Does anyone knows how to make it works ? Or how to allow emojis with firestore rules ?

Thanks for your help !

about 4 years ago · Juan Pablo Isaza
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda