Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

193
Views
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
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!