I am running Ruby on Rails 3.0.10 and Ruby 1.9.2. I am using the following Regex in order to match names:
NAME_REGEX = /^[ws'"-_&@!?()[]-]*$/u
validates :name,
:presence => true,
:format => {
:with => NAME_REGEX,
:message => "format is invalid"
}
However, if I try to save some words like the followings:
Oilalà
Pì
Rùby
...
# In few words, those with accented characters
I have a validation error "Name format is invalid.
.
How can I change the above Regex so to match also accented characters like à
, è
, é
, ì
, ò
, ù
, ...?
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…