1
email: function( value, element ) {
            // From https://html.spec.whatwg.org/multipage/forms.html#valid-e-mail-address
            // Retrieved 2014-01-14
            // If you have a problem with this implementation, report a bug against the above spec
            // Or use custom methods to implement your own email validation
            return this.optional( element ) || /^[a-zA-Z0-9.!#$%&'*+\/=?^_`{|}~-]+@[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)*$/.test( value );
        }

i found above code in jquery validation plugin for email validation here i replaced the regex with others but still it validates email as "example@example" but in my application i want it to validate emails of type "example@example.example" only ,is this regex expression only which needs to be changed or some other part of the code too because changing regex didn't worked for me

chris
  • 141
  • 2
  • 8
  • @Naruto it didn't work in my case – chris Dec 21 '15 at 17:30
  • Really, really just do some basic stuff (*somewhat@somewhat.something*) and actually **write an email to that specific address** as email adresses tend to be more complicated than one would have expected in the first place. – Jan Dec 21 '15 at 17:31

1 Answers1

2

Just change the last * (zero or more) to + (one or more) to force at least one .something:

/^[a-zA-Z0-9.!#$%&'*+\/=?^_`{|}~-]+@[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)+$/
                                                                                                                                    ^
# This is the only change ----------------------------------------------------------------------------------------------------------|

Online demo

Giuseppe Ricupero
  • 6,134
  • 3
  • 23
  • 32