Breyta

Deila með


Regex.Count Method

Definition

Overloads

Count(ReadOnlySpan<Char>)

Searches an input span for all occurrences of a regular expression and returns the number of matches.

Count(String)

Searches an input string for all occurrences of a regular expression and returns the number of matches.

Count(ReadOnlySpan<Char>, Int32)

Searches an input span for all occurrences of a regular expression and returns the number of matches.

Count(ReadOnlySpan<Char>, String)

Searches an input span for all occurrences of a regular expression and returns the number of matches.

Count(String, String)

Searches an input string for all occurrences of a regular expression and returns the number of matches.

Count(ReadOnlySpan<Char>, String, RegexOptions)

Searches an input span for all occurrences of a regular expression and returns the number of matches.

Count(String, String, RegexOptions)

Searches an input string for all occurrences of a regular expression and returns the number of matches.

Count(ReadOnlySpan<Char>, String, RegexOptions, TimeSpan)

Searches an input span for all occurrences of a regular expression and returns the number of matches.

Count(String, String, RegexOptions, TimeSpan)

Searches an input string for all occurrences of a regular expression and returns the number of matches.

Count(ReadOnlySpan<Char>)

Source:
Regex.Count.cs
Source:
Regex.Count.cs
Source:
Regex.Count.cs

Searches an input span for all occurrences of a regular expression and returns the number of matches.

public:
 int Count(ReadOnlySpan<char> input);
public int Count (ReadOnlySpan<char> input);
member this.Count : ReadOnlySpan<char> -> int
Public Function Count (input As ReadOnlySpan(Of Char)) As Integer

Parameters

input
ReadOnlySpan<Char>

The span to search for a match.

Returns

The number of matches.

Applies to

Count(String)

Source:
Regex.Count.cs
Source:
Regex.Count.cs
Source:
Regex.Count.cs

Searches an input string for all occurrences of a regular expression and returns the number of matches.

public:
 int Count(System::String ^ input);
public int Count (string input);
member this.Count : string -> int
Public Function Count (input As String) As Integer

Parameters

input
String

The string to search for a match.

Returns

The number of matches.

Exceptions

input is null.

Applies to

Count(ReadOnlySpan<Char>, Int32)

Source:
Regex.Count.cs
Source:
Regex.Count.cs
Source:
Regex.Count.cs

Searches an input span for all occurrences of a regular expression and returns the number of matches.

public:
 int Count(ReadOnlySpan<char> input, int startat);
public int Count (ReadOnlySpan<char> input, int startat);
member this.Count : ReadOnlySpan<char> * int -> int
Public Function Count (input As ReadOnlySpan(Of Char), startat As Integer) As Integer

Parameters

input
ReadOnlySpan<Char>

The span to search for a match.

startat
Int32

The zero-based character position at which to start the search.

Returns

The number of matches.

Applies to

Count(ReadOnlySpan<Char>, String)

Source:
Regex.Count.cs
Source:
Regex.Count.cs
Source:
Regex.Count.cs

Searches an input span for all occurrences of a regular expression and returns the number of matches.

public:
 static int Count(ReadOnlySpan<char> input, System::String ^ pattern);
public static int Count (ReadOnlySpan<char> input, string pattern);
static member Count : ReadOnlySpan<char> * string -> int
Public Shared Function Count (input As ReadOnlySpan(Of Char), pattern As String) As Integer

Parameters

input
ReadOnlySpan<Char>

The span to search for a match.

pattern
String

The regular expression pattern to match.

Returns

The number of matches.

Exceptions

A regular expression parsing error occurred.

Applies to

Count(String, String)

Source:
Regex.Count.cs
Source:
Regex.Count.cs
Source:
Regex.Count.cs

Searches an input string for all occurrences of a regular expression and returns the number of matches.

public:
 static int Count(System::String ^ input, System::String ^ pattern);
public static int Count (string input, string pattern);
static member Count : string * string -> int
Public Shared Function Count (input As String, pattern As String) As Integer

Parameters

input
String

The string to search for a match.

pattern
String

The regular expression pattern to match.

Returns

The number of matches.

Exceptions

input or pattern is null.

A regular expression parsing error occurred.

Applies to

Count(ReadOnlySpan<Char>, String, RegexOptions)

Source:
Regex.Count.cs
Source:
Regex.Count.cs
Source:
Regex.Count.cs

Searches an input span for all occurrences of a regular expression and returns the number of matches.

public:
 static int Count(ReadOnlySpan<char> input, System::String ^ pattern, System::Text::RegularExpressions::RegexOptions options);
public static int Count (ReadOnlySpan<char> input, string pattern, System.Text.RegularExpressions.RegexOptions options);
static member Count : ReadOnlySpan<char> * string * System.Text.RegularExpressions.RegexOptions -> int
Public Shared Function Count (input As ReadOnlySpan(Of Char), pattern As String, options As RegexOptions) As Integer

Parameters

input
ReadOnlySpan<Char>

The span to search for a match.

pattern
String

The regular expression pattern to match.

options
RegexOptions

A bitwise combination of the enumeration values that specify options for matching.

Returns

The number of matches.

Exceptions

options is not a valid bitwise combination of RegexOptions values.

A regular expression parsing error occurred.

Applies to

Count(String, String, RegexOptions)

Source:
Regex.Count.cs
Source:
Regex.Count.cs
Source:
Regex.Count.cs

Searches an input string for all occurrences of a regular expression and returns the number of matches.

public:
 static int Count(System::String ^ input, System::String ^ pattern, System::Text::RegularExpressions::RegexOptions options);
public static int Count (string input, string pattern, System.Text.RegularExpressions.RegexOptions options);
static member Count : string * string * System.Text.RegularExpressions.RegexOptions -> int
Public Shared Function Count (input As String, pattern As String, options As RegexOptions) As Integer

Parameters

input
String

The string to search for a match.

pattern
String

The regular expression pattern to match.

options
RegexOptions

A bitwise combination of the enumeration values that specify options for matching.

Returns

The number of matches.

Exceptions

input or pattern is null.

options is not a valid bitwise combination of RegexOptions values.

A regular expression parsing error occurred.

Applies to

Count(ReadOnlySpan<Char>, String, RegexOptions, TimeSpan)

Source:
Regex.Count.cs
Source:
Regex.Count.cs
Source:
Regex.Count.cs

Searches an input span for all occurrences of a regular expression and returns the number of matches.

public:
 static int Count(ReadOnlySpan<char> input, System::String ^ pattern, System::Text::RegularExpressions::RegexOptions options, TimeSpan matchTimeout);
public static int Count (ReadOnlySpan<char> input, string pattern, System.Text.RegularExpressions.RegexOptions options, TimeSpan matchTimeout);
static member Count : ReadOnlySpan<char> * string * System.Text.RegularExpressions.RegexOptions * TimeSpan -> int
Public Shared Function Count (input As ReadOnlySpan(Of Char), pattern As String, options As RegexOptions, matchTimeout As TimeSpan) As Integer

Parameters

input
ReadOnlySpan<Char>

The span to search for a match.

pattern
String

The regular expression pattern to match.

options
RegexOptions

A bitwise combination of the enumeration values that specify options for matching.

matchTimeout
TimeSpan

A time-out interval, or InfiniteMatchTimeout to indicate that the method should not time out.

Returns

The number of matches.

Exceptions

options is not a valid bitwise combination of RegexOptions values, or matchTimeout is negative, zero, or greater than approximately 24 days.

A regular expression parsing error occurred.

Applies to

Count(String, String, RegexOptions, TimeSpan)

Source:
Regex.Count.cs
Source:
Regex.Count.cs
Source:
Regex.Count.cs

Searches an input string for all occurrences of a regular expression and returns the number of matches.

public:
 static int Count(System::String ^ input, System::String ^ pattern, System::Text::RegularExpressions::RegexOptions options, TimeSpan matchTimeout);
public static int Count (string input, string pattern, System.Text.RegularExpressions.RegexOptions options, TimeSpan matchTimeout);
static member Count : string * string * System.Text.RegularExpressions.RegexOptions * TimeSpan -> int
Public Shared Function Count (input As String, pattern As String, options As RegexOptions, matchTimeout As TimeSpan) As Integer

Parameters

input
String

The string to search for a match.

pattern
String

The regular expression pattern to match.

options
RegexOptions

A bitwise combination of the enumeration values that specify options for matching.

matchTimeout
TimeSpan

A time-out interval, or InfiniteMatchTimeout to indicate that the method should not time out.

Returns

The number of matches.

Exceptions

input or pattern is null.

options is not a valid bitwise combination of RegexOptions values, or matchTimeout is negative, zero, or greater than approximately 24 days.

A regular expression parsing error occurred.

Applies to