正则表达式简单的检查输入email是否合法程序
程序员文章站
2022-07-02 20:45:47
function chkemail(email) on error resume next dim i,l,pos1,po...
function chkemail(email)
on error resume next
dim i,l,pos1,pos2
chkemail=true
if isnull(email) then chkemail=false:exit function
pos1= instr(email,"@")
pos2=instrrev(email,".")
if not(pos1>0) or not (pos2>0) or pos1>pos2 then
chkemail=false
end if
if err.number<>0 then err.clear
end function
on error resume next
dim i,l,pos1,pos2
chkemail=true
if isnull(email) then chkemail=false:exit function
pos1= instr(email,"@")
pos2=instrrev(email,".")
if not(pos1>0) or not (pos2>0) or pos1>pos2 then
chkemail=false
end if
if err.number<>0 then err.clear
end function