I need help getting the regex format of my usernames correct. It suppose to require 3 letters in it and allow no spaces or _. I think I’m on the right track so far with this:
validates_format_of :username, :with => /([^a-zA-Z]*([a-zA-Z]+)[^a-zA-Z]*){3,}/
This allows spaces though and I’m not sure if this is correct in general. What corrections do I need for this regex to get rid of the ability to use spaces or _?
If you mean it has to be all letters, it’s just:
Otherwise, use a lookahead: