C# Класс Patterns.Text.RegularExpressions.CompiledRegex

Provides a Regex implementation that is easier to instantiate.
Instances of the CompiledRegex type are always "compiled"; that is, their RegexOptions always include the RegexOptions.Compiled option.
Наследование: System.Text.RegularExpressions.Regex
Показать файл Открыть проект Примеры использования класса

Открытые методы

Метод Описание
BuildFrom ( string text, RegexOptions options = RegexOptions.None ) : CompiledRegex

Builds a new CompiledRegex instance from the specified raw text. Reserved characters are automatically escaped, causing them to serve as required components of the resulting pattern. Whitespace is always interpreted to be of variable length (i.e. all contiguous whitespace blocks are replaced with the \s+ search term). Useful in scenarios were existing text is used to match against other values.

CompiledRegex ( string pattern, RegexOptions options = RegexOptions.None ) : System

Initializes a new instance of the CompiledRegex class.

DictionaryMatch ( string input, bool removeSystemGroups = true ) : string>.IDictionary

Gets the first pattern match as a key-value dictionary. Useful with patterns that use named groups.

DictionaryMatches ( string input, bool removeSystemGroups = true ) : string>>.IEnumerable

Gets the pattern matches as key-value dictionaries. Useful with patterns that use named groups.

Приватные методы

Метод Описание
CompiledRegex ( ) : System
ConvertMatchToDictionary ( Match match, bool removeSystemGroups ) : string>.IDictionary
GetOptions ( RegexOptions originalOptions ) : RegexOptions
IsSystemGroup ( string>.KeyValuePair pair ) : bool

Описание методов

BuildFrom() публичный статический Метод

Builds a new CompiledRegex instance from the specified raw text. Reserved characters are automatically escaped, causing them to serve as required components of the resulting pattern. Whitespace is always interpreted to be of variable length (i.e. all contiguous whitespace blocks are replaced with the \s+ search term). Useful in scenarios were existing text is used to match against other values.
public static BuildFrom ( string text, RegexOptions options = RegexOptions.None ) : CompiledRegex
text string The raw text.
options RegexOptions The options (optional).
Результат CompiledRegex

CompiledRegex() публичный Метод

Initializes a new instance of the CompiledRegex class.
public CompiledRegex ( string pattern, RegexOptions options = RegexOptions.None ) : System
pattern string The regular expression.
options RegexOptions The options (optional).
Результат System

DictionaryMatch() публичный Метод

Gets the first pattern match as a key-value dictionary. Useful with patterns that use named groups.
public DictionaryMatch ( string input, bool removeSystemGroups = true ) : string>.IDictionary
input string The input.
removeSystemGroups bool True to remove system-added groups (such as group "0", "1", etc.) /// before extracting dictionary values. The default is true.
Результат string>.IDictionary

DictionaryMatches() публичный Метод

Gets the pattern matches as key-value dictionaries. Useful with patterns that use named groups.
public DictionaryMatches ( string input, bool removeSystemGroups = true ) : string>>.IEnumerable
input string The input.
removeSystemGroups bool True to remove system-added groups (such as group "0") before extracting /// dictionary values. The default is true.
Результат string>>.IEnumerable