开发者

Routing error with certains emails

开发者 https://www.devze.com 2023-02-01 10:53 出处:网络
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).

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

精彩评论

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

关注公众号