Am 20.09.2009 um 05:46 schrieb Wang Pengcheng:

> First , please use the white list not the black list in the regex.
> Second, please validate the length of the input data.
>
> /^[\d\w]+$/i

As a side note, and if you insist on being pedantic, I'd suggest using  
\A and \Z to delimit the beginning and the end of the whole string in  
the regex, as opposed to ^ and $ only matching the beginning and the  
end of a line in ruby, who knows, maybe one your users will try to use  
a password with a newline in it ;-)

Felix

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Talk" group.
To post to this group, send email to rubyonrails-talk@googlegroups.com
To unsubscribe from this group, send email to 
rubyonrails-talk+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to