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).

Infact any s present makes the system go haywire...

this is the constraint in the route...

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

Answers


Try the following regexp:

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

Need Your Help

GridView bound manually doesn't display data at all

c# asp.net gridview

This is my first time to ask a question so please be patient with me. I've a GridView with templatefields and the datasource is a Business Logic Layer method that retrieve a list of employee via Data

About UNIX Resources Network

Original, collect and organize Developers related documents, information and materials, contains jQuery, Html, CSS, MySQL, .NET, ASP.NET, SQL, objective-c, iPhone, Ruby on Rails, C, SQL Server, Ruby, Arrays, Regex, ASP.NET MVC, WPF, XML, Ajax, DataBase, and so on.