StringAssert.Matches Method

Definition

Overloads

Matches(String, Regex)

Tests whether the specified string matches a regular expression and throws an exception if the string does not match the expression.

Matches(String, Regex, String)

Tests whether the specified string matches a regular expression and throws an exception if the string does not match the expression.

Matches(String, Regex, String, Object[])

Tests whether the specified string matches a regular expression and throws an exception if the string does not match the expression.

Matches(String, Regex)

Tests whether the specified string matches a regular expression and throws an exception if the string does not match the expression.

public:
 static void Matches(System::String ^ value, System::Text::RegularExpressions::Regex ^ pattern);
public static void Matches (string value, System.Text.RegularExpressions.Regex pattern);
static member Matches : string * System.Text.RegularExpressions.Regex -> unit
Public Shared Sub Matches (value As String, pattern As Regex)

Parameters

value
String

The string that is expected to match pattern.

pattern
Regex

The regular expression that value is expected to match.

Exceptions

Thrown if value does not match pattern.

Applies to

Matches(String, Regex, String)

Tests whether the specified string matches a regular expression and throws an exception if the string does not match the expression.

public:
 static void Matches(System::String ^ value, System::Text::RegularExpressions::Regex ^ pattern, System::String ^ message);
public static void Matches (string value, System.Text.RegularExpressions.Regex pattern, string message);
static member Matches : string * System.Text.RegularExpressions.Regex * string -> unit
Public Shared Sub Matches (value As String, pattern As Regex, message As String)

Parameters

value
String

The string that is expected to match pattern.

pattern
Regex

The regular expression that value is expected to match.

message
String

The message to include in the exception when value does not match pattern. The message is shown in test results.

Exceptions

Thrown if value does not match pattern.

Applies to

Matches(String, Regex, String, Object[])

Tests whether the specified string matches a regular expression and throws an exception if the string does not match the expression.

public:
 static void Matches(System::String ^ value, System::Text::RegularExpressions::Regex ^ pattern, System::String ^ message, ... cli::array <System::Object ^> ^ parameters);
public static void Matches (string value, System.Text.RegularExpressions.Regex pattern, string message, params object[] parameters);
static member Matches : string * System.Text.RegularExpressions.Regex * string * obj[] -> unit
Public Shared Sub Matches (value As String, pattern As Regex, message As String, ParamArray parameters As Object())

Parameters

value
String

The string that is expected to match pattern.

pattern
Regex

The regular expression that value is expected to match.

message
String

The message to include in the exception when value does not match pattern. The message is shown in test results.

parameters
Object[]

An array of parameters to use when formatting message.

Exceptions

Thrown if value does not match pattern.

Applies to