English Deutsch Français Italiano Español Português 繁體中文 Bahasa Indonesia Tiếng Việt ภาษาไทย
All categories

Hello.. I'm doing an assignment in web developing using C#.. I'm required to make a validator, so that the value entered in a textbox is a valid SMU email. The valid SMU email is ....@sis/accountancy/socsc/business/economics.smu.edu.sg

I've placed a regular expression validator, but i'm confused how to validate, what to put (such as \w,\d, or??).

Appreciate your helps. =)

2006-11-16 01:46:59 · 1 answers · asked by sylvdoanx 2 in Computers & Internet Programming & Design

correction : the valid smu email

.....@sis/accountancy/business/socsc/economics.smu.edu.sg

2006-11-16 01:48:19 · update #1

1 answers

' Validate an e-mail address
' Example:
' MessageBox.Show(IsValidEmail("mbellinaso@vb2themax.com")) ' True
' MessageBox.Show(IsValidEmail("vb2themax.com")) ' False
' MessageBox.Show(IsValidEmail("mbellinaso@vb2themax")) ' False

VB version:

Function IsValidEmail(ByVal email As String) As Boolean
Return System.Text.RegularExpressions.Regex.IsMatch(email, _
"^\w+([-+.]\w+)*@\w+([-.]\w+)*\.\w+([-.]\w+)*$")
End Function

As C#:
bool IsValidEmail(string email)
{
return System.Text.RegularExpressions.Regex.IsMatch(email, "^\w+([-+.]\w+)*@\w+([-.]\w+)*\.\w+([-.]\w+)*$");
}

2006-11-16 09:08:29 · answer #1 · answered by Steve A 2 · 0 0

fedest.com, questions and answers