开发者

Routing error with certains emails

Rails routes wont accept a route if the email is of the form amits321321@sma.com but this comes out fine amit321321@sma.com (notice the s).

Inf开发者_StackOverflowact any s present makes the system go haywire...

this is the constraint in the route...

:constraints => { :email => /([^@\s]+)@((?:[-a-z0-9]+\.)+[a-z]{2,})/ }


Try the following regexp:

/^([\w\.%\+\-]+)@([\w\-]+\.)+([\w]{2,})$/i
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜