Regular expression syntax

xiaoxiao2021-03-06  54

Visual Basic VBScript matches

Scripting edition

/ ^ / [/ t] * $ / "^ / [/ t] * $" matches a blank line.

// D {2} - / d {5} / "/ d {2} - / d {5}" Verify that a ID number is 2 digits, one

Monolithic characters and a 5-digit composition.

/< (.*)>. (*)>. * "matches an HTML tag.

The table below is a complete list of metamorphic and its behavior in the regular expression context:

Character description

/ Tag the next character as a special character, or a primary character, or after

To a reference, or an octave. For example, 'n' matches characters "n". '/ N'

Match a newline. Sequence '//' Match "/" and "match" (".

^ Match the start position of the input string. If the regexp object is set

Multiline properties, ^ also matches the location after '/ n' or '/ r'.

$ Match the end position of the input string. If the regexp object is set

Multiline properties, $ also matching '/ n' or '/ r' before.

* Match the previous sub-expression zero or multiple times. For example, ZO * can match "Z" and

"zoo". * Equivalent to {0,}.

Match the previous sub-expression once or multiple times. For example, 'ZO ' can match "ZO"

And "ZOO" but cannot match "Z". Equivalent to {1,}.

• Match the previous sub-expression zero or once. For example, "Do (ES)?" Can match

"do" in "do" or "does". Is equivalent to {0,1}.

{n} n is a non-negative integer. Match the determined N times. For example, 'o {2}' cannot match

"Bob" 'o', but can match two O in "Food".

{n,} n is a non-negative integer. At least n times. For example, 'o {2,}' cannot match

'O' in "Bob", but can match all O "fooood". 'O {1,}'

Equivalent to 'o '. 'O {0,}' is equivalent to 'o *'.

{N, M} M and N are non-negative integers, where n <= m. Match at least n times and up to do

With M times. Liu, "O {1, 3}" will match the top three O in "foooood".

'O {0,1}' is equivalent to 'o?'. Please note that there is no space between commas and two numbers.

• When this character is tight in any other restriction (*, ,?, {N}, {n,},

When the {n, m} is followed, the matching mode is unresurred. Non-greedy mode as possible

Match the search string, and the default greed mode is as many as possible

String of the cable. For example, for strings "oooo", 'o ?' Will match a single

"o", and 'o ' will match all 'o'.

Match any individual characters other than "/ n". To match anything including '/ n'

What characters, please use the mode of '[./n]'.

(Pattern) Match Pattern and get this match. The acquired matches can be generated

Matches collection, use Submatches collection in VBScript,

$ 0 ... $ 9 properties are used in Visual Basic scripting edition. To match the bracket characters, use '/ (' or '/)'.

(?: pattern) Match Pattern but does not get matching results, that is, this is a non-acquisition.

With, it is not used for storage. This is combined using "or" characters (|)

Various parts of a model are useful. For example, 'industr (?: Y | iES)

It is a smale of 'Industry | Industries'.

(? = pattern) Positive summation, match the lookup character at any string of Pattern's string

string. This is a non-acquisition match, that is, the match does not need to get a supply.

use. For example, 'windows (? = 95 | 98 | NT | 2000)' Can match "Windows

"Windows" in 2000, but does not match "Windows" in "Windows3.11".

The forecast does not consume characters, that is, after a match occurs, in the last move

Start the next matching search immediately after matching, not the character included

Post.

(?! pattern) Negatively to check, in any mismatch, Negative Lookahead matches the

Search string at any point where a string not matching

Pattern's string is started to match the lookup string. This is a non-acquisition

With, that is, the match does not need to be used later. For example 'windows

(?! 95 | 98 | NT | 2000) 'Match "Windows" in "Windows 3.1",

But you can't match "Windows" in "Windows 2000". Not consuming words

That is, after a match occurs, open immediately after the last match

Start the next match, not starting from the character containing the queen

X | Y matches X or Y. For example, 'Z | Food' can match "z" or "food". '(Z | f)

OOD 'matches "Zood" or "Food".

[XYZ] Character collection. Match any of the included characters. For example, '[ABC]'

Match 'A' in "Plain".

[^ XYZ] Negative character set. Match any of the characters that are not included. For example, '[^ ABC]'

Match 'P' in "Plain".

[A-Z] character range. Match any of the characters within the specified range. For example, '[a-z]' can be

Arbitrary lowercase letters in the range of 'A' to 'Z'.

[^ a-z] Negative character range. Match any of any characters that are not within the specified range. E.g,

'[^ A-z]' can match any of any characters that are not in the 'A' to 'Z'.

/ b Match a word boundary, that is, the location of the words and spaces. E.g,

'ER / B' can match 'Er' in "Never", but do not match "Verb"

'ER'.

/ B matches non-word boundary. 'ER / B' can match 'Er' in "Verb", but not

Er 'in "Never".

/ CX matches the control character indicated by x. For example, / cm matches a Control-M or

Enter. The value of x must be one of A-Z or A-Z. Otherwise, treat C as one

Original 'c' character. / d Match a numeric character. Equivalent to [0-9].

/ D Match a non-digital character. Equivalent to [^ 0-9].

/ f Match a change page. Equivalent to / x0c and / cl.

/ n Match a newline. Equivalent to / x0a and / cj.

/ r Match a carriage return. Equivalent to / X0D and / cm.

/ s Match any blank character, including spaces, tabs, change page, and the like. Equivalent to

[/ f / n / r / t / v].

/ S Match any non-blank character. Equivalent to [^ / f / N / R / T / V].

/ t matches a tab. Equivalent to / x09 and / ci.

/ v Match a vertical tab. Equivalent to / x0b and / ck.

/ w Match any word character that includes underscore. Equivalent to '[A-ZA-Z0-9_]'.

/ W Match any non-word characters. Equivalent to '[^ a-za-z0-9_]'.

/ XN matches n, where n is a hexadecimal escape value. Hexadecimal escape value must be true

Two numbers long. For example, '/ x41' matches "a". '/ X041'

The '/ x04' & "1". ASCII coding can be used in regular expressions. .

/ NUM matches NUM, where NUM is a positive integer. References to the acquired match.

For example, '(.) / 1' matches two consecutive identical characters.

/ n identifies an octal escape value or a rearward reference. If / n is at least n

The acquired sub-expression, then n is a backward reference. Otherwise, if n is an octal

Numbers (0-7), then n is an eight-input escape value.

/ Nm identifies an octal escape value or a backward reference. If / nm has at least

Is Precededed by Least NM Gets the gathered expression, Nm is

A reference. If there is at least n acquisitions before / nm, then n is a post-text

The backward reference of the word M. If the previous conditions are not met, if n and m are

Octa (0-7), / nm will match the eight-en-en-esca-value NM.

/ Nml If n is an octal number (0-3), and M and L are eight input numbers (0-

7), match the eight-way escape value NML.

/ UN matches N, where N is a Unicode word represented by four hexadecimal numbers.

symbol. For example, / u00A9 matches copyright symbol (?).

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

New Post(0)