The period (.) Matches any single print or non-printing character in a string, except for the wrap (/ N). The following JScript regular expression can match 'AAC', 'ABC', 'ACC', 'ADC', and the like can also match 'A1C', 'A2C', A-C 'and A # C':
/a.c/
Equivalent VBScript regular expression is:
"a.c"
If you try to match a string containing the file name, the period (.) Is part of the input string, you can add a backslash (/) character in front of the period in the regular expression to achieve this requirement. For example, the following JScript regular expression can match 'filename.ext':
/filename/.ext/
For VBScript, the equivalent expression is as follows:
"filename / .ext"
These expressions are still quite limited. They only allow matching any single characters. In many cases, it is useful to match special characters from the list. For example, if the input text contains the number representation as Chapter 1, Chapter 2, the chapter title you may need to find these chapters.
Braces expressions
One or more single characters can be placed in a square bracket ([and]) to create a list of to be matched. If the character is placed in parentheses, the list is called a bracket expression. Like anywhere in parentheses, ordinary characters represent itself, that is, they match one of them in the input text. Most special characters will lose their meaning when located in parentheses. There are some exceptions here:
']' Character If it is not the first item, a list will be ended. To match the ']' character in the list, put it in the first item, followed behind the start '['. '/' Is still an escap. To match '/' characters, use '//'.
The characters included in parentheses are only matched to a single character in the parentheses expression in the regular expression. The following JScript regular expressions can match 'Chapter 1', 'Chapter 2', 'Chapter 3', 'Chapter 4' and 'Chapter 5':
/ Chapter [12345] /
In VBScript, you must match the same chapter title, please use the following expression:
"Chapter [12345]"
Note that the word 'Chapter' and the positional relationship of the characters in the brackets are fixed. Therefore, bracket expressions are only used to specify a character set that satisfies the single-character position immediately after the word 'Chapter' and a space. Here is the ninth character position.
If you want to use the range instead of the character itself, you can use a hyphen to separate the start and end characters of the range. The character value of each character will determine its relative order in a range. The following JScript regular expression contains an equivalent to the range expressions of the parentheses shown above.
/ Chapter [1-5] /
The expression of the same function in VBScript is as follows:
"Chapter [1-5]"
If the range is specified in this manner, the start and end values are included in this range. One thing to note is that the starting value in Unicode sort must be before the end value.
If you want to include even characters in parentheses, you must use one of the following methods:
Use a backslash to escape: [/ -] placed the hinder in the start and end position of the parentheses list. The following expression can match all lowercase letters and hyphens: [-A-z] [A-z-] creates a range, where the value of the start character is less than the hyphen, and the value of the end character is equal to or greater than the hyperpoint. The following two regular expressions meet this requirement: [! -]
[! - ~]
Similarly, by placing an insert (^) at the beginning of the list (^), you can find all characters in the list or range. If the insert appears in other locations of the list, it matches its own, there is no special meaning. The following JScript regular expression match chapter section is more than 5 chapter title:
/ CHAPTER [^ 12345] /
Use VBScript:
"Chapter [^ 12345]"
In the example shown above, the expression will match any numeric characters other than 1, 2, 3, 4, or 5 in the ninth position. Therefore, 'Chapter 7' is a match, the same 'Chapter 9' is also the same.
The above expression can be represented using a hyphen (-). For JScript:
/ Chapter [^ 1-5] /
Or, VBScript is:
"Chapter [^ 1-5]"
Typical usage of parentheses is to specify matching of any uppercase or lowercase alphanumeric characters or any numbers. The following JScript expressions give this match:
/ [A-za-z0-9] /
Equivalent VBScript expression is:
"[A-ZA-Z0-9]"