accept an email id & validate it .email id should not exceed
25 characters the mail id should contain 3 characters
excluding domain name,@ and .(dot) the last 3 characters
of the domain should be net,com or org
Answer Posted / pankaj jaju
Function IsValidEmail(strEmail)
If Len(strEmail) > 25 Then
IsValidEmail = "Email contains > 25 characters"
ElseIf LCase(Right(strEmail, 4)) <> ".net" AND LCase
(Right(strEmail, 4)) <> ".com" AND LCase(Right(strEmail,
4)) <> ".org" Then
IsValidEmail = "Email contains invalid
domain name. Use only .com or .net or .org domains only"
ElseIf UBound(Split(strEmail,"@")) > 1 Then
IsValidEmail = "@ character is used
multiple time"
ElseIf UBound(Split(strEmail,"@")) < 1 Then
IsValidEmail = "@ character is missing"
Else
IsValidEmail = True
End If
End Function
Is This Answer Correct ? | 0 Yes | 0 No |
Post New Answer View All Answers
Why is the use of exit do or exit for statements within loops discouraged?
Explain about scrrun.dll in vbscript?
What are the special sub-types in vbscript?
How are comments handled in the vbscript language?
What is byref and byval parameters in vbscript?
If we take 2 strings as “good” and “bad” then what will ‘+’ and ‘&’ operators return?
How can you create an object in vbscript?
Explain about vb script?
How to access array data?
Which operator can be used to do an xor operation in vbscript?
What are the rules to name variable in vbscript?
What is the use of the recordset object and which statement is used to create such an object?
Write program for identifyig duplicates in flight Departing from and Arriving in mercury tours(web application).
Why to use option explicit in vb script?
What is event handling in vbscript?