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


Please Help Members By Posting Answers For Below Questions

Why is the use of exit do or exit for statements within loops discouraged?

558


Explain about scrrun.dll in vbscript?

642


What are the special sub-types in vbscript?

543


How are comments handled in the vbscript language?

508


What is byref and byval parameters in vbscript?

598






If we take 2 strings as “good” and “bad” then what will ‘+’ and ‘&’ operators return?

530


How can you create an object in vbscript?

610


Explain about vb script?

743


How to access array data?

537


Which operator can be used to do an xor operation in vbscript?

674


What are the rules to name variable in vbscript?

579


What is the use of the recordset object and which statement is used to create such an object?

527


Write program for identifyig duplicates in flight Departing from and Arriving in mercury tours(web application).

1438


Why to use option explicit in vb script?

592


What is event handling in vbscript?

591