Understand the use of regular expressions in ASP through several very practical examples

xiaoxiao2021-03-06  113

?

Understand the use of regular expressions in ASP through several very practical examples

We know that in VBScript 5.0, we have supported regular expressions. Below we help us understand and use this good program writing format 1 first, password verify that our password verification rule is the first code One letter cannot be a number, the length of the password is between 4 and 16 and the password can only contain characters, numbers and underscores.

We don't think about whether such restrictions make sense, our task is to learn the regular expression Function ValidatePassword (strpassword) Dim Reset Re = new regexpre.ignorecase = falsere.global = falsere.pattern = "^ [A-ZA-Z ] / w {3,15} $ "validatePassword = Re.test (strpassword) End function explanation ^ Symbol indicates that the rule of the back connection is the processing limit for the first character, he must be determined by [A-ZA-Z] The rule is in line with the rule of [A-ZA-Z] - "[" indicates that the end "]" indicates that the end {and} indicates that the expression rules containing characters, numbers, and underscores are / W According to this rule, we continue to see a test rule taken by the email address 2.Email address inspection

This email check rule is that we generally use the detection rules for the MAIL address.

Through these two examples, we briefly understand the powerful features of regular expressions in practical applications. ?

转载请注明原文地址:https://www.9cbs.com/read-125490.html

New Post(0)