var at="@"
var dot="."
var lat=strEmail.indexOf(at)
var lstr=strEmail.length var
if (strEmail.indexOf(at)==-1)
{
alert("Invalid E-mail ID")
return false
}
if (strEmail.indexOf(at)==-1 || strEmail.indexOf(at)==0 || strEmail.indexOf(at)==lstr)
{
alert("Invalid E-mail ID")
return false
}
if (strEmail.indexOf(dot)==-1 || str.indexOf(dot)==0 || strEmail.indexOf(dot)==lstr)
{
alert("Invalid E-mail ID")
return false
}
if (strEmail.indexOf(at,(lat+1))!=-1)
{
alert("Invalid E-mail ID")
return false
}
if (strEmail.substring(lat-1,lat)==dot || strEmail.substring(lat+1,lat+2)==dot)
{
alert("Invalid E-mail ID")
return false
}
if (strEmail.indexOf(dot,(lat+2))==-1)
{
alert("Invalid E-mail ID")
return false
}
if (strEmail.indexOf(" ")!=-1)
{
alert("Invalid E-mail ID")
return false
}
or
Imports System.Text.RegularExpressions
Public Class Form1
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Dim pattern As String
pattern = "^([0-9a-zA-Z]([-\.\w]*[0-9a-zA-Z])*@([0-9a-zA-Z][-\w]*[0-9a-zA-Z]\.)+[a-zA-Z]{2,9})$"
If Regex.IsMatch("feedback@net-informations.com", pattern) Then
MsgBox("Valid Email address ")
Else
MsgBox("Not a valid Email address ")
End If
End Sub
End Class
or
Imports System.Text.RegularExpressions
Public Class Form1
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Dim pattern As String
pattern = "^([0-9a-zA-Z]([-\.\w]*[0-9a-zA-Z])*@([0-9a-zA-Z][-\w]*[0-9a-zA-Z]\.)+[a-zA-Z]{2,9})$"
If Regex.IsMatch("feedback@net-informations.com", pattern) Then
MsgBox("Valid Email address ")
Else
MsgBox("Not a valid Email address ")
End If
End Sub
End Class