regular expression to allow only these two type
i.e., something@ gmail.com
or [email protected]
only gmail or nishant .com should be allowed
what will b regex for this.
Loading
Know the answer? Post it — somebody with the same question will find it here.
Sign in to answer this question
It is the same account you read, post and publish with — and you will come straight back to this page.
Jaganathan BantheswaranPosted Oct 10, 2013, 3:24 AM
Try like this
use this pattern "^[a-zA-Z0-9._]+(@gmail\.com|@nishant\.com)$"
It allows like this string,
[email protected]
[email protected]..
nishant ranjanPosted Oct 10, 2013, 5:01 AM
Puneet GuptaPosted Oct 10, 2013, 4:32 AM
if (reg.test(val))
alert("success");
else
alert("fail");
Thanks,
Puneet Gupta