如何检测邮箱中带点"."的个数
如何检测邮箱中带点"."的个数
[解决办法]
alert("a.2.4.5@11.com".match(/\./g).length)
[解决办法]
Function getEmailDotLen(s)
dim l=0,sp=".",aryReturn
if s!="" then
If InStr(s,sp)=0 then '去除开头的.
s=Mid(s,1)
end if
aryReturn = Split(s,sp)'用点分割字符串得到数组
getEmailDotLen=UBound(aryReturn)+1
end if
getEmailDotLen=l
End Function
Response.Write getEmailDotLen("a.2.4.5@11.com")
[解决办法]
dim re, email, matchesemail= "a.b.c.s@163.com."Set re=new RegExpre.Global=truere.MultiLine=truere.pattern= "\."set matches = re.Execute(email)response.write(matches.count)
[解决办法]
s="abc.abc.abc"
i = len(s)-len(replace(s,".",""))