Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

184
Vistas
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 la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda