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("abcdefg
IsValidEmail = false exit function end if 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 end if next if Left(name, 1) = "." or Right(name, 1) = "."...
IsValidEmail = false exit function end if if InStr(email, "..") > 0 then IsValidEmail = false end if end function %> 第三種辦法,用下面這個函數(shù)進行判斷。它會檢查郵件地址是否含有“@”,以及“.”是否在“@”后面: function isEmail(pInString) lAt = False lDot = false for x = 2 to ...
Function IsValidEmail(strIn As String) As Boolean ' Return true if strIn is in valid e-mail format. Return Regex.IsMatch(strIn, ("^([\w-\.]+)@((\[[0-9]{ 1,3 }\.[0-9]{ 1,3 }\.[0-9]{ 1,3 }\.)|(([\w-]+\.)+))([a-zA-Z]{ 2,4 }|[0-9]{ 1,3 })(\]...
public bool IsValidEmail(string strIn) { // Return true if strIn is in valid e-mail format. return Regex.IsMatch(strIn, @"^([/w-/.]+)@((/[[0-9]{1,3}/.[0-9]{1,3}/.[0-9]{1,3}/.)|(([/w-]+/.)+))([a-zA-Z]{2,4}|[0-9]{1,3})(/]?)$"); ...
string emailInput = Console.ReadLine(); bool match = Regex.IsMatch(emailInput, emailPattern); if (match) Console.WriteLine("E-mail address is valid."); else Console.WriteLine("Supplied input is not a valid e-mail address."); 不要擔心上面的正則表達式是否有意義。電子郵件模式背后隱藏的基本思...