A reminder that a regex ending in "$" probably doesn't do what you want it to do (unless you are using #rakulang!)
(I.E. /^[0-9]$/ will match both "0" and "0\n")
You probably want \z (edit). \n will generally match either the end of the string or a newline right before the end of the string. So if you don't want newlines in your database...
This is true in #perl and #python. However, #rakulang redefines default $ matching behavior, so it does not match a trailing newline by default.