As 이메일, 핸드폰 번호 유효성 검증 함수

7050 단어 함수
'********************************************
'
:IsValidEmail
'
: Email
'
:email ---- Email
'
:True ----Email
'
False ----Email
'
********************************************
Function IsValidEmail(Email)
Dim names, name, I, c
IsValidEmail
= True
names
= Split(Email, "@")
If UBound(names)
<> 1 Then IsValidEmail = False: Exit Function
For Each name In names
If Len(name)
<= 0 Then IsValidEmail = False:Exit Function
For I
= 1 To Len(name)
c
= LCase(Mid(name, I, 1))
If InStr(
"abcdefghijklmnopqrstuvwxyz_-.", c) <= 0 And Not IsNumeric(c) Then IsValidEmail = False:Exit Function
Next
If Left(name,
1) = "." Or Right(name, 1) = "." Then IsValidEmail = False:Exit Function
Next
If InStr(names(
1), ".") <= 0 Then IsValidEmail = False:Exit Function
I
= Len(names(1)) - InStrRev(names(1), ".")
If I
<> 2 And I <> 3 Then IsValidEmail = False:Exit Function
If InStr(Email,
"..") > 0 Then IsValidEmail = False
End Function

  
'********************************************
'
:ValidMobile
'

'
:str ----
'
:True ----
'
False ----
'
********************************************
Function ValidMobile(ByVal str)
Dim reg
Set reg
= New RegExp
reg.Pattern
= "^1[358][\d]{9}$"
ValidMobile
= reg.test(str)
Set reg
= Nothing
End Function

좋은 웹페이지 즐겨찾기