zaneray / scrupulous

Simple inline form validation using HTML5 attributes that plays nicely with Bootstrap
GNU General Public License v2.0
13 stars 4 forks source link

email pattern doesn't work #10

Open luckybusted opened 7 years ago

luckybusted commented 7 years ago

The standard e-mail pattern "[^@]+@[^@]+.[a-zA-Z]{2,6}" doesn't work because of the backslash. Since the backslash is a escape character in JS the parsed HTML looks like: pattern="[^@]+@[^@]+.[a-zA-Z]{2,6}"

Solution: add a backslash before the backslash to escape the escape character. Like this: emailPattern = "[^@]+@[^@]+\\.[a-zA-Z]{2,6}"