Get the App
SLTechnology News&Howtos  ›  Development  › 

Syntax Summary of VBS regular expressions

Shulou Source: shulou.com Published: 2022-06-03 17:56:28 09月12日 Update

This article mainly talks about "grammatical summary of VBS regular expressions". Interested friends may wish to take a look. The method introduced in this paper is simple, fast and practical. Let's let the editor take you to learn the grammar summary of VBS regular expressions.

Regular expression syntax

A regular expression is a text pattern consisting of ordinary characters (such as characters a to z) and special characters (called metacharacters). The pattern describes one or more strings to be matched when finding the body of the text. The regular expression acts as a template that matches a character pattern with the searched string.

Here are some examples of regular expressions that you might encounter:

Visual Basic Scripting EditionVBScript match / ^\ [\ t] * $/ "^\ [\ t] * $" matches a blank line. /\ d {2} -\ d {5} / "\ d {2} -\ d {5}" verify that an ID number consists of a 2-digit number, a hyphen, and a 5-digit number. /. * / ". *" matches a HTML tag.

The following table is a complete list of metacharacters and their behavior in the context of regular expressions:

Character description\ marks the next character as a special character, or a literal character, or a backward reference, or an octal escape character. For example,'n 'matches the character "n".' \ n' matches a newline character. The sequence'\ 'matches "\" and "(" matches "(". ^ matches the starting position of the input string. If the Multiline property of the RegExp object is set, ^ also matches the position after'\ n'or'\ r'. $matches the end of the input string. If the Multiline property of the RegExp object is set, $also matches the position before'\ n'or'\ r'. * matches the previous subexpression zero or more times. For example, zo* can match "z" and "zoo". * is equivalent to {0,}. + matches the previous subexpression one or more times. For example, 'zo+' can match "zo" and "zoo", but not "z". + is equivalent to {1,}. ? Matches the previous subexpression zero or once. For example, "do (es)?" Can match "do" in "do" or "does". ? It is equivalent to {0jue 1}. {n} n is a non-negative integer. Match the determined n times. For example,'o {2} 'does not match the' o'in 'Bob', but does match the two o in 'food'. {n,} n is a non-negative integer. Match at least n times. For example,'o {2,} 'does not match' o'in 'Bob', but does match all o in 'foooood'. O {1,}'is equivalent to 'oasis'. O {0,}'is equivalent to 'oval'. {n ·m} m} m and n are non-negative integers, where n

Tags: Character equivalence expression string octal number regular pattern escape that is range that is position word search grammar two integer greed tab Apple Docker Huawei Linux macOS MariaDB Microsoft MySQL NVidia OPPO Reno Linux MariaDB MySQL Xiaomi Docker