To create a Firebase Realtime Database rule to validate that new data starts with a certain string, for example with foo
:
terminal{ "rules": { "concurrent": { ".read": true, ".write": true, "$uid": { "connected": { ".validate": "newData.val().matches(/^foo/)" } } } } }
You can use RegEx within the matches()
method.
Hi, I'm Erik, an engineer from Barcelona. If you like the post or have any comments, say hi.