Use the rules formula to confirm the form input: John R. Lewis Translation: Waffle First, the introduction to the form code is what we often do, and often become very complicated and messy. This article will introduce how to simplify your code with rule formulas. Second, the problem writing form confirmation code is not only a problem that is null or looking for a specific data type, things may be much more messy than this. A simple example requires the user to enter the E-mail address. You need to determine if the user is entered in the form of a@b.c, not something else. This issue will be complicated. Third, the solution is summarized, that is, use a regular expression. It may be because the UINX platform supports this technology at its turn, so Microsoft is not touting it as a script platform. Below is a definition of Microsoft: The regular expression is a text style consisting of normal characters (such as letters A to Z) and special characters (such as metammatics). Style describes one or more strings used to match. The rule style is a template that matches the search string. Fourth, the example of Microsoft's grammatical detection is good. However, if you expect, in the actual example, they are very short. The following is a simple example: 'Example 1 Function ValidateEmail (Expression) DIM ObjRegexp set objRegexp.pattern = "^ [/ w /.-] @[/ w /.-] /. [A-ZA -Z] $ "ValidateEmail = ObjRegexp.test (Expression) End Function Example 1 is an example of detecting an E-mail address. Under the first look, the style string is very chaotic, and it doesn't matter. Let's take a closer study of each of its elements. ^ - Indicates that the matching character is displayed from the first character from the input. [/W/.-] - Braces indicate the range of characters. "/ w" indicates that any command character includes underscores, equivalent to "[A-ZA-Z0-9_]." "/." Indicates adding the sentence to the range of characters. The period is a special symbol, which is why we have to add parentheses. "-" means adding a homer to the character range. " " Indicates that the symbols are matched once or more. @ - Obviously, we need to see "@" characters here. [/W/.-] We have seen it once, as mentioned above. - Here we need to see "." Characters. [A-ZA-Z] - Here we can use "/ W" instead. But according to I know, there is no use of numbers and underscores (.com, .net, etc.). $ - "$" character indicates the end. 'Example 2 Function Validatensn (Expression) DIM ObjregExp Set Objregexp = New Regexp ObjRegexp.pattern = "^ / D {3} - / D {2} - / d {4} $" Validatessn = ObjRegexp.test (Expression) End Function Example 2 is an example of a public key legitimacy check. "/ d {3}" syntax indicates whether it is three digits. Others are very simple. 5. Summary is as seen from the example, using the rules formula to simplify your code. The only difficult point is to learn the pattern syntax. I hope that my example can inspire you use this powerful technology!