Regex for lastname or firstname in rails -
i know question on asked, couldn't find fits in case , works rails. i'm looking simple regex words can contain:
- letters(no digits)
- white spaces
- . (dot) or - (dash)
the following regex allows letters, white space, dot , dash:
/[a-z\s.-]/i
your validation in model be:
validates_format_of :first_name, :with => /[a-z\s.-]/i
Comments
Post a Comment