C# Class Pihrtsoft.Text.RegularExpressions.Linq.RegexUtility

Provides static methods for escaping and validating regular expressions elements.
Show file Open project: JosefPihrt/LinqToRegex

Public Methods

Method Description
Escape ( char value ) : string

Converts a specified character to the string object that represents the character as a literal rather than a metacharacter. The character is considered not to be in the character group.

Escape ( char value, bool inCharGroup ) : string

Converts a specified character to the string object that represents the character as a literal rather than a metacharacter.

Escape ( string input ) : string

Converts a specified text to the string object that represents each character as a literal rather than a metacharacter. The text is considered not to be in the character group.

Escape ( string input, bool inCharGroup ) : string

Converts a specified input to the string object that represents each character as a literal rather than a metacharacter.

EscapeSubstitution ( string input ) : string

Escapes all dollar signs by doubling them.

GetBlockDescription ( NamedBlock block ) : string

Gets a description of the specified Unicode block.

GetBlockDesignation ( NamedBlock block ) : string

Gets a designation of the specified Unicode block.

GetCategoryDescription ( GeneralCategory category ) : string

Gets a description of the specified Unicode category.

GetCategoryDesignation ( GeneralCategory category ) : string

Gets a designation of the specified Unicode category.

GetEscapeMode ( char value ) : CharEscapeMode

Gets a value indicating how a specified character is represented in the regular expression pattern.

GetEscapeMode ( char value, bool inCharGroup ) : CharEscapeMode

Gets a value indicating how a specified character is represented in the regular expression pattern, specifying whether the character is inside or outside of the character group.

GetRandomGroupName ( ) : string

Returns randomly generated group name.

GetRandomGroupName ( int length ) : string

Returns randomly generated group name with a specified length.

IsValidGroupName ( string groupName ) : bool

Gets a value indicating whether the specified group name is a valid name of a regex group.

IsValidInlineOptions ( RegexOptions options ) : bool

Gets a value indicating whether the options can be expressed as inline char(s).

Private Methods

Method Description
CheckGroupName ( string groupName ) : void
CheckGroupName ( string groupName, string paramName ) : void
EscapeInternal ( int charCode, bool inCharGroup ) : string
EscapeSubstitution ( string input, int i, StringBuilder sb ) : void
GetEscapeMode ( int charCode, bool inCharGroup ) : CharEscapeMode
GetEscapeModeInternal ( int charCode, bool inCharGroup ) : CharEscapeMode
IsValidGroupNameInternal ( string groupName ) : bool

Method Details

Escape() public static method

Converts a specified character to the string object that represents the character as a literal rather than a metacharacter. The character is considered not to be in the character group.
public static Escape ( char value ) : string
value char A Unicode character.
return string

Escape() public static method

Converts a specified character to the string object that represents the character as a literal rather than a metacharacter.
public static Escape ( char value, bool inCharGroup ) : string
value char A Unicode character.
inCharGroup bool Indicates whether the character is considered to be inside or outside of the character group.
return string

Escape() public static method

Converts a specified text to the string object that represents each character as a literal rather than a metacharacter. The text is considered not to be in the character group.
is null.
public static Escape ( string input ) : string
input string The text to be converted.
return string

Escape() public static method

Converts a specified input to the string object that represents each character as a literal rather than a metacharacter.
is null.
public static Escape ( string input, bool inCharGroup ) : string
input string The text to be converted.
inCharGroup bool Indicates whether the text is considered to be inside or outside of the character group.
return string

EscapeSubstitution() public static method

Escapes all dollar signs by doubling them.
is null.
public static EscapeSubstitution ( string input ) : string
input string The substitution pattern to be escaped.
return string

GetBlockDescription() public static method

Gets a description of the specified Unicode block.
public static GetBlockDescription ( NamedBlock block ) : string
block NamedBlock An enumerated constant that identifies Unicode block.
return string

GetBlockDesignation() public static method

Gets a designation of the specified Unicode block.
public static GetBlockDesignation ( NamedBlock block ) : string
block NamedBlock An enumerated constant that identifies Unicode block.
return string

GetCategoryDescription() public static method

Gets a description of the specified Unicode category.
public static GetCategoryDescription ( GeneralCategory category ) : string
category GeneralCategory An enumerated constant that identifies Unicode category.
return string

GetCategoryDesignation() public static method

Gets a designation of the specified Unicode category.
public static GetCategoryDesignation ( GeneralCategory category ) : string
category GeneralCategory An enumerated constant that identifies Unicode category.
return string

GetEscapeMode() public static method

Gets a value indicating how a specified character is represented in the regular expression pattern.
public static GetEscapeMode ( char value ) : CharEscapeMode
value char A Unicode character.
return CharEscapeMode

GetEscapeMode() public static method

Gets a value indicating how a specified character is represented in the regular expression pattern, specifying whether the character is inside or outside of the character group.
public static GetEscapeMode ( char value, bool inCharGroup ) : CharEscapeMode
value char A Unicode character.
inCharGroup bool Indicates whether the character is inside or outside of the character group.
return CharEscapeMode

GetRandomGroupName() public static method

Returns randomly generated group name.
public static GetRandomGroupName ( ) : string
return string

GetRandomGroupName() public static method

Returns randomly generated group name with a specified length.
is less than one.
public static GetRandomGroupName ( int length ) : string
length int Length of a group name.
return string

IsValidGroupName() public static method

Gets a value indicating whether the specified group name is a valid name of a regex group.
public static IsValidGroupName ( string groupName ) : bool
groupName string A group name to examine.
return bool

IsValidInlineOptions() public static method

Gets a value indicating whether the options can be expressed as inline char(s).
public static IsValidInlineOptions ( RegexOptions options ) : bool
options RegexOptions A bitwise combination of the enumeration values.
return bool