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

what is the standards used for writing the script in QTP

1892


what types of bugs will we find out in banking projects for automation testing?

1769


How will you convert a string to lower case string using vbscript?

561


In the Web page we have a table link, if we click on that link all the contents under that link will be sorted (asscending/Descending). Now i want to check in which order the list is ? for that i need to get the data in to some var How can i get that cells data?

2026


What is the main difference between function and sub-procedure?

555






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

684


Mention what is select case statement?

550


What is the technology used by vb script?

544


What are the advantages of vbscript?

648


What is vbscript language used for and which earlier language is it modeled upon?

539


What is the purpose of regexp object in vbscript?

559


How do i automate a website www.flyashx.com without having any test cases witin a week time.

1461


What are keywords in the vbscript language?

528


Explain about vb script?

753


How will you compare two strings in vbscript?

598