I think many people have already done some similar development tasks:
I would like to check people's email address only if it matches @ tomtom.com or @ stream.com.
I currently have two solutions:
Function use indexof()
var checkTomTomEmail=eo.data.username.indexOf("@tomtom.com");
var checkStreamEmail=eo.data.username.indexOf("@stream.com");
if (checkTomTomEmail >0 || checkStreamEmail >0 )
{
}
Else
{
}
Using Compliance
var patt1=/@tomtom.com/gi;
var patt2=/@stream.com/gi;
var checkTomTomEmail=eo.data.username.match(patt1);
var checkStreamEmail=eo.data.username.match(patt2);
if(indexOf(checkTomTomEmail)> 1 ||indexOf (checkStreamEmail)>1)
{
}
I still think that I am not considering all the details yet. Any suggestions?
thank
QLiu source
share