Class RegexPattern
Defines the pattern matching on strings that follow a regular expression.
public record RegexPattern : Pattern<string?>, IEquatable<Pattern>, IEquatable<Pattern<string?>>, IEquatable<RegexPattern>
- Inheritance
-
RegexPattern
- Implements
- Inherited Members
Constructors
RegexPattern(RegexPattern)
protected RegexPattern(RegexPattern original)
Parameters
originalRegexPattern
RegexPattern(string)
Creates a regex pattern.
public RegexPattern(string pattern)
Parameters
patternstringThe regular expression to match.
RegexPattern(Regex)
Defines the pattern matching on strings that follow a regular expression.
public RegexPattern(Regex ExpectedPattern)
Parameters
ExpectedPatternRegexThe expected regular expression the input string should follow.
Properties
EqualityContract
protected override Type EqualityContract { get; }
Property Value
ExpectedPattern
The expected regular expression the input string should follow.
public Regex ExpectedPattern { get; init; }
Property Value
Methods
Deconstruct(out Regex)
public void Deconstruct(out Regex ExpectedPattern)
Parameters
ExpectedPatternRegex
Equals(Pattern<string?>?)
public override sealed bool Equals(Pattern<string?>? other)
Parameters
Returns
Equals(RegexPattern?)
public virtual bool Equals(RegexPattern? other)
Parameters
otherRegexPattern
Returns
Equals(object?)
public override bool Equals(object? obj)
Parameters
objobject
Returns
Format(IndentedTextWriter)
Serializes the pattern to a readable string.
public override void Format(IndentedTextWriter writer)
Parameters
writerIndentedTextWriterThe output stream.
GetHashCode()
public override int GetHashCode()
Returns
Match(string?, MatchingContext)
Attempts to match the provided input to the pattern.
public override IMatchNode<string?>? Match(string? identifier, MatchingContext context)
Parameters
identifierstringcontextMatchingContextThe context in which to match the pattern to.
Returns
- IMatchNode<string>
When successful, returns the root node of the match tree, otherwise
null.
PrintMembers(StringBuilder)
protected override bool PrintMembers(StringBuilder builder)
Parameters
builderStringBuilder
Returns
Operators
operator ==(RegexPattern?, RegexPattern?)
public static bool operator ==(RegexPattern? left, RegexPattern? right)
Parameters
leftRegexPatternrightRegexPattern
Returns
operator !=(RegexPattern?, RegexPattern?)
public static bool operator !=(RegexPattern? left, RegexPattern? right)
Parameters
leftRegexPatternrightRegexPattern