In my user model, I have the attribute "nickname" and is checked as such:
validates_format_of: nickname ,: with => / [a-zA-Z0-9] $ /,: allow_nil => true
However, this string is currently passed as valid:
a? WITH
I only want to accept alphanumeric strings - does anyone know why my regex doesn't work? If anyone can offer a better regex, I'm all ears.
source share