String.Match(String) Method

Top 

Description

Returns the number of regular expression matches between the calling String and the specified String argument. In order to return a match, the String argument must match the entire string - this can be accomplished using regular expressions. A successful pattern match always returns >= 1, where multiple matches come from user specified groupings.

 

Regular Expressions

Description

.

Returns any character except \n (line feed), \r (carriage return)

|

Returns either the first or second item, can be strung together

{n}

Returns the previous item exactly n times; n>=1

{n,}

Returns the previous item at least n times, looks first for most matches possible; n>=0

{n,m}

Returns the previous item starting with m times before reducing repetition to n times; n>=0, m>=n

(...){n}

Matches group (...) if found {n} number of times, if n = 1, {n} is not needed

[...]

Matches a single character out of all possibilities offered, special characters will need an escape sequence

[ - ]

Hyphen indicates a range of characters, numbers to match; specifies a hyphen if immediately after [

[^ ]

Returns any character except those indicated within brackets

\

Indicates an escape sequence to suppress special characters

\Q...\E

Matches the characters between \Q and \E literally, suppressing the meaning of special characters

\d

Matches any decimal digits, can be used inside [...]

\w

Matches any word character, can be used inside [...]

\s

Matches any whitespace, can be used inside [...]

\D

Matches a character that is not a digit, can be used inside [...]

\W

Matches a character that is not a word character, can be used inside [...]

\S

Matches a character that is not a whitespace, can be used inside [...]

\n

Matches a line feed

\t

Matches a tab

*

0 or more of previous expression

+

1 or more of previous expression

?

0 or 1 of previous expression

 

 

Timing Precision Mode

This page describes functionality in nanosecond timing precision mode.

Click here to see the documentation for this object in millisecond timing precision mode.

 

Method Signature

String.Match(

String regularExpression)

 

 

Arguments

regularExpression


Description:

A regular expression that defines the pattern to match against.

 

 

 

Return Value

Type:

number

 

 

Returns the number of regular expression matches between the calling String and the regular expression specified by regularExpression.

 

Syntax

myVariable1 = myString1.Match(myString2);

 

 

See also

String Object

String.Match

Parsing Dates and Times

Parsing Arbitrary String Data

Parsing Arbitrary String Data