Just contact regular expression, found that its function unexpectedly so “ very good very strong &rdquo, and then use C # to write a mailbox verification, little brother dishes, if there are deficiencies please point out, but also want to contact the regular expression of the brothers and sisters help.
Here is the Code section:
Using System;
Using System.Collections.Generic;
Using System.ComponentModel;
Using System.Data;
Using System.Drawing;
Using System.Text;
Using System.Windows.Forms;
Using System.Text.RegularExpressions; namespace Regulatortest {public partial class Form1:form {public Form1 () {I
Nitializecomponent (); } private void btnTest_Click (object sender, EventArgs e) {//verify e-mail Format St
Ring Regexemail = "//w{1,}@//w{1,}//.//w{1,}"; System.Text.RegularExpressions.RegexOptions options = ( System.Text.RegularExpressions.RegexOptions.IgnorePatternWhitespace | System.Text.RegularExpressions.RegexOptions.Multiline) |
System.Text.RegularExpressions.RegexOptions.IgnoreCase);
System.Text.RegularExpressions.Regex regemail = new System.Text.RegularExpressions.Regex (regexemail, Options);
string email = Txtemail.text;
if (regemail.ismatch (email))//email fill in the regular expression "//w{1,}@//w{1,}//.//w{1,}" { MessageBox.Show ("Conforming to regular expression: +regemail.tostring () +"/N mailbox completed successfully.
"); else {MessageBox.Show ("does not conform to regular expression: +regemail.tostring () +"/N mailbox format is not correct.)
");
Return
//Verify that the password is made up of no less than 6-bit alphanumeric underline special symbols. String regexpwd = "^. {6,15}___fckpd___0quot;;/ /Limit the beginning, must start from the first match, limit the end, the total number of digits must not exceed 15 digits, otherwise even greater than 15 bits can still verify through System.Text.RegularExpressions.Regex regpwd = new System.te Xt.
Regularexpressions.regex (regexpwd, Options);
string pwd = Txtpwd.text; if (Regpwd.ismatch (pwd)) {MessageBox.Show ("conforming to regular expression: +regpwd.tostring () +"//n Password Authentication passed.
"); else {MessageBox.Show ("does not conform to regular expression: +regpwd.tostring () +"//n Password Authentication failed.) The password should be made up of no less than 6-bit alphanumeric underline special symbols.
");
Return }} PRivate void Form1_Load (object sender, EventArgs e) {}}