O'Reilly logo

VBScript in a Nutshell by Ron Petrusha, Paul Lomax, Matt Childs

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Name

RegExp.Pattern Property

Data Subtype

String

Description

Contains a pattern string that defines the substring to be found in a search string.

Rules at a Glance

The following table defines the meaning of the individual characters that can be included in the pattern string. The table in the “Programming Tips & Gotchas” section lists a pattern string using each symbol and shows the results returned by the Execute method.

Symbol

Description

\

Marks the next character as either a special character (such as \n for the newline character) or as a literal (if that character otherwise has special meaning in a pattern search string). The special characters are:

\f: form feed character

\n: newline character

\r: carriage return character

\t: tab character

\v: vertical tab character

^

Matches the beginning of input.

$

Matches the end of input.

*

Matches the preceding character zero or more times.

+

Matches the preceding character one or more times.

?

Matches the preceding character zero or one time.

.

Matches any single character except a newline character.

( )

Defines a subexpression within the larger subexpression. A subexpression:

  • Overrides the order of precedence used in evaluating pattern strings

  • Can be referenced again in the pattern string. To insert the result of the subexpression later in the pattern string, reference it by its one-based ordinal position among subexpressions, preceded by the backslash symbol (e.g., \1). See the example using the \num ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required