Class RegexHelper
Provides helper methods for working with regular expressions and wildcard masks.
Inheritance
Inherited Members
Namespace: Nevatech.Vsb.Repository
Assembly: Nevatech.Vsb.Repository.dll
Syntax
public static class RegexHelper
Methods
HasWildcards(String)
Checks if provided value contains wildcard characters (* or ?).
Declaration
public static bool HasWildcards(string pattern)
Parameters
Type | Name | Description |
---|---|---|
System.String | pattern | String to be checked for wildcards. |
Returns
Type | Description |
---|---|
System.Boolean | True if provided value contains wildcard characters. False otherwise. |
IsWildcardMatch(String, String)
Executes the match operation of the provided string value against the specified search pattern.
Declaration
public static bool IsWildcardMatch(string pattern, string value)
Parameters
Type | Name | Description |
---|---|---|
System.String | pattern | Pattern that may have * and ? wildcards for matching multiple or single characters. |
System.String | value | Value to be matched. |
Returns
Type | Description |
---|---|
System.Boolean | True, if provided value is matched by the pattern. False, otherwise. |
ReplaceEnvironmentalVariables(String, Boolean)
Replaces the "{env:VariableName:DefaultValue}" tokens in the provided text with the corresponding environmental variable values.
Declaration
public static string ReplaceEnvironmentalVariables(string text, bool isXml = true)
Parameters
Type | Name | Description |
---|---|---|
System.String | text | Text where tokens need to be replaced. |
System.Boolean | isXml | Flag indicating that provided text is XML. If True then environmental value will be XML-encoded before replacing the token. |
Returns
Type | Description |
---|---|
System.String | Provided text with the tokens been replaced. |