I’m using the following regex to validate one of my models
validates :login,
:format => {:with => /[A-Za-z][A-Za-z0-9_]+/}
And one of my tests is failing because this regex is matching this string, passing it as valid
a+df
What am I missing here?
It matches the
dfsubstring. Use anchors to force the regex to match the string in its entirety: