Share via


Assert.MatchesRegex Method

Definition

Overloads

MatchesRegex(String, String, String)

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

MatchesRegex(Regex, String, String)

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

MatchesRegex(String, String, String, String, String)

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

MatchesRegex(Regex, String, String, String, String)

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

MatchesRegex(String, String, String)

Source:
Assert.Matches.cs
Source:
Assert.Matches.cs

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

public static void MatchesRegex(string? pattern, string? value, string message = "");
static member MatchesRegex : string * string * string -> unit
Public Shared Sub MatchesRegex (pattern As String, value As String, Optional message As String = "")

Parameters

pattern
String

The regular expression that value is expected to match.

value
String

The string that is expected to match pattern.

message
String

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

Exceptions

value is null, or pattern is null, or value does not match pattern.

Applies to

MatchesRegex(Regex, String, String)

Source:
Assert.Matches.cs
Source:
Assert.Matches.cs

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

public static void MatchesRegex(System.Text.RegularExpressions.Regex? pattern, string? value, string message = "");
static member MatchesRegex : System.Text.RegularExpressions.Regex * string * string -> unit
Public Shared Sub MatchesRegex (pattern As Regex, value As String, Optional message As String = "")

Parameters

pattern
Regex

The regular expression that value is expected to match.

value
String

The string that is expected to match pattern.

message
String

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

Exceptions

value is null, or pattern is null, or value does not match pattern.

Applies to

MatchesRegex(String, String, String, String, String)

Source:
Assert.Matches.cs

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

public static void MatchesRegex(string? pattern, string? value, string? message = "", string patternExpression = "", string valueExpression = "");
static member MatchesRegex : string * string * string * string * string -> unit
Public Shared Sub MatchesRegex (pattern As String, value As String, Optional message As String = "", Optional patternExpression As String = "", Optional valueExpression As String = "")

Parameters

pattern
String

The regular expression that value is expected to match.

value
String

The string that is expected to match pattern.

message
String

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

patternExpression
String

The syntactic expression of pattern as given by the compiler via caller argument expression. Users shouldn't pass a value for this parameter.

valueExpression
String

The syntactic expression of value as given by the compiler via caller argument expression. Users shouldn't pass a value for this parameter.

Exceptions

value is null, or pattern is null, or value does not match pattern.

Applies to

MatchesRegex(Regex, String, String, String, String)

Source:
Assert.Matches.cs

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

public static void MatchesRegex(System.Text.RegularExpressions.Regex? pattern, string? value, string? message = "", string patternExpression = "", string valueExpression = "");
static member MatchesRegex : System.Text.RegularExpressions.Regex * string * string * string * string -> unit
Public Shared Sub MatchesRegex (pattern As Regex, value As String, Optional message As String = "", Optional patternExpression As String = "", Optional valueExpression As String = "")

Parameters

pattern
Regex

The regular expression that value is expected to match.

value
String

The string that is expected to match pattern.

message
String

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

patternExpression
String

The syntactic expression of pattern as given by the compiler via caller argument expression. Users shouldn't pass a value for this parameter.

valueExpression
String

The syntactic expression of value as given by the compiler via caller argument expression. Users shouldn't pass a value for this parameter.

Exceptions

value is null, or pattern is null, or value does not match pattern.

Applies to