1, verify the mailbox (user name)
JS page:first define variables and regularvarUsermail = $ ("#usermail"). Val (); var username=/^ ([a-za-z0-9_-]) [email protected] ([a-za-z0-9_-]) + (. [ A-za-z0-9_-]) +/; make judgments//Regular expression to determine the mailboxif(!username.test (Usermail)) {Alert ("Incorrect mailbox Format");}
on the Aspx.cs page://Regular expression to determine whether the mailbox conforms tostringPat =@ "^ ([a-za-z0-9]|[. _]) [Email protected] ([a-za-z0-9_-]) + (\.[ A-za-z0-9_-]) + ";//Regular judgment MailboxRegexR =NewRegex(Pat,RegexOptions. IgnoreCase);Matchm = R.match (Usermail);if(!m.success) {Response.Write ("username");return; } (The following direct write regular expression)2. Verify the phone numbervarMobile =/^1[3|4|5|8][0-9]\d{4,8}$/;//Regular expression to determine the format of the phone number (only the correct phone number can be entered)3. Verify the passwordvarpass =/^[a-za-z]\w{5,15}$/;//Regular expression to determine the user password (beginning with a letter, length between 6~16, can contain only characters, numbers, and underscores)4. Verification CodevarCode =/^\d{4}$/;//Regular expression to determine the format of the verification code (only 4 digits can be entered)
Validation with regular expressions on the registration page (Js/aspx.cs)