Microsoft Office Tutorials and References
In Depth Information
Regular expressions
public static bool EmailValidate(string strEmail)
{
string strRegex = @"^([a-zA-Z0-9_\-\.]+)@((\[[0-9]{1,3}" +
@"\.[0-9]{1,3}\.[0-9]{1,3}\.)|(([a-zA-Z0-9\-]+\" + @".)+))(
[a-zA-Z]{2,4}|[0-9]{1,3})(\]?)$";
Regex emailRegEx = new Regex(strRegex);
if (emailRegEx.IsMatch(strEmail))
{
return (true);
}
else
{
return (false);
}
}
The following screenshot shows the results of adding and executing the
preceding code:
Regular expressions are used to find frequent occurrences of a pattern of characters
within a string. These characters are of two types—one that includes alphabetic
characters and numerals, called literal characters, and one that includes special
characters such as * or @ or #. In the previous example, a regular expression was
implemented using smart tags. You can also implement regular expressions via
other controls and events, and not just through smart tags.
 
Search JabSto ::




Custom Search