Archive

Archive for November, 2013

Regular expression validation for email

November 29, 2013 Leave a comment

Normally if you use ‘RegularExpressionValidator’ control to validate the E-Mail, you will select ‘Internet Email address’. By default it will return ‘\w+([-+.’]\w+)*@\w+([-.]\w+)*\.\w+([-.]\w+)*’

Above expression will accept like ‘kethare@mydomain.co.in.info’, But in my scenario it should accept only two sub domain as ‘kethare@yahoo.co.in’

ValidationExpression=’^[-0-9a-zA-Z.+_]+@[a-zA-Z+_]+\.[a-zA-Z]{2,4}\.{0,1}[a-zA-Z]{2,4}$’

Advertisements
%d bloggers like this: