Class RegexHelper
Provides helper methods for working with regular expressions and wildcard masks.
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 |
|---|---|---|
| string | pattern | String to be checked for wildcards. |
Returns
| Type | Description |
|---|---|
| bool | 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 |
|---|---|---|
| string | pattern | Pattern that may have * and ? wildcards for matching multiple or single characters. |
| string | value | Value to be matched. |
Returns
| Type | Description |
|---|---|
| bool | True, if provided value is matched by the pattern. False, otherwise. |
ReplaceEnvironmentalVariables(string, bool)
Replaces the "{env:VariableName:DefaultValue}" tokens in the provided text with the corresponding environmental variable values.
Declaration
[SuppressMessage("Microsoft.Design", "CA1026:DefaultParametersShouldNotBeUsed")]
public static string ReplaceEnvironmentalVariables(string text, bool isXml = true)
Parameters
| Type | Name | Description |
|---|---|---|
| string | text | Text where tokens need to be replaced. |
| bool | isXml | Flag indicating that provided text is XML. If True then environmental value will be XML-encoded before replacing the token. |
Returns
| Type | Description |
|---|---|
| string | Provided text with the tokens been replaced. |