Validate full_name
A regular expression to validate a full_name
validates :full_name,
presence: true,
length: { maximum: 50, minimum: 5 },
format: {
with: /^[\p{L}\p{Nl}[^0-9`!@#\$%\^&*+_=]]{2,}[\s]{1,}[\p{L}\p{Nl}[^0-9`!@#\$%\^&*+_=]]{2,}$/u,
message: 'write your real name.'
}
I tested this against many cases. If it fails somehow let me know.
Written by Amr Tamimi
Related protips
Have a fresh tip? Share with Coderwall community!
Post
Post a tip
Best
#Ruby
Authors
Sponsored by #native_company# — Learn More
#native_title#
#native_desc#