Class CMSRegex
Defined lazy initialized regular expression
public class CMSRegex : CMSLazy<Regex>
- Inheritance
-
objectCMSLazy<Regex>CMSRegex
- Inherited Members
- Extension Methods
Constructors
CMSRegex(string, bool)
Constructor
public CMSRegex(string pattern, bool ignoreCase)
Parameters
patternstringExpression pattern
ignoreCaseboolIf true, the regular expression is case insensitive
CMSRegex(string, RegexOptions)
Constructor
public CMSRegex(string pattern, RegexOptions options = RegexOptions.Compiled)
Parameters
patternstringExpression pattern
optionsRegexOptionsOptions
Fields
IgnoreCase
Defines the options for ignoring case within regular expression
public const RegexOptions IgnoreCase = IgnoreCase | CultureInvariant
Field Value
- RegexOptions
Methods
EnsureCorrectOptions(RegexOptions)
Adds CultureInvariant option when there is ignore case to ensure correct behavior in Turkish culture.
public static RegexOptions EnsureCorrectOptions(RegexOptions options)
Parameters
optionsRegexOptionsOptions to be modified
Returns
- RegexOptions
GetDefaultOptions(bool)
Gets the default options for a regular expression
public static RegexOptions GetDefaultOptions(bool ignoreCase)
Parameters
ignoreCaseboolIf true, the regular expression is case insensitive
Returns
- RegexOptions
IsMatch(string)
Returns true if the given pattern is found within the input string
public bool IsMatch(string input)
Parameters
inputstringInput string
Returns
- bool
Match(string)
Searches the specified input string for the first occurrence of the regular expression
public Match Match(string input)
Parameters
inputstringInput text
Returns
- Match
Matches(string)
Searches the specified input for all recurrences of regular expression
public MatchCollection Matches(string input)
Parameters
inputstringInput text
Returns
- MatchCollection
Replace(string, string, bool)
Replaces the specified pattern within the given input with the given replacement
public string Replace(string input, string replacement, bool allowSubstitutions = true)
Parameters
inputstringInput string
replacementstringReplacement
allowSubstitutionsboolIf set to false, substitutions are not allowed within the replacement string
Returns
- string
Replace(string, MatchEvaluator)
Replaces the specified pattern within the given input with the given replacement
public string Replace(string input, MatchEvaluator evaluator)
Parameters
inputstringInput string
evaluatorMatchEvaluatorMatch evaluator
Returns
- string