日期:2014-05-17 浏览次数:21162 次
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, matches email= "a.b.c.s@163.com." Set re=new RegExp re.Global=true re.MultiLine=true re.pattern= "\." set matches = re.Execute(email) response.write(matches.count)
------解决方案--------------------
s="abc.abc.abc"
i = len(s)-len(replace(s,".",""))