StringAssert.Matches Method
Definition
Important
Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.
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)
- Source:
- StringAssert.cs
- Source:
- StringAssert.cs
- Source:
- StringAssert.cs
- Source:
- StringAssert.cs
- Source:
- StringAssert.cs
- Source:
- StringAssert.cs
- Source:
- StringAssert.cs
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 (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
value
is null, or pattern
is null,
or value
does not match pattern
.
Applies to
Matches(String, Regex, String)
- Source:
- StringAssert.cs
- Source:
- StringAssert.cs
- Source:
- StringAssert.cs
- Source:
- StringAssert.cs
- Source:
- StringAssert.cs
- Source:
- StringAssert.cs
- Source:
- StringAssert.cs
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 (string value, System.Text.RegularExpressions.Regex pattern, 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
value
is null, or pattern
is null,
or value
does not match pattern
.
Applies to
Matches(String, Regex, String, Object[])
- Source:
- StringAssert.cs
- Source:
- StringAssert.cs
- Source:
- StringAssert.cs
- Source:
- StringAssert.cs
- Source:
- StringAssert.cs
- Source:
- StringAssert.cs
- Source:
- StringAssert.cs
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 (string value, System.Text.RegularExpressions.Regex pattern, string message, params 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
value
is null, or pattern
is null,
or value
does not match pattern
.