Legend

Class
Struct
Enum
Interface
Delegate
Constructor
Method
Property
Event
Field

Sealed class: RT.Generexes.Generex<T>

Summary

Provides regular-expression functionality for collections of arbitrary objects.

Generic type parameters

T Type of the objects in the collection.

Constructors

Instantiates an empty regular expression (always matches).
Generex<T>(params T[] elements)
Instantiates a regular expression that matches a sequence of consecutive elements.
Generex<T>(IEnumerable<T> elements)
Generex<T>(IEqualityComparer<T> comparer, params T[] elements)
Instantiates a regular expression that matches a sequence of consecutive elements using the specified equality comparer.
Generex<T>(IEqualityComparer<T> comparer, IEnumerable<T> elements)
Generex<T>(Predicate<T> predicate)
Instantiates a regular expression that matches a single element that satisfies the given predicate (cf. [...] in traditional regular expression syntax).
Generex<T>(params Generex<T>[] generexSequence)
Instantiates a regular expression that matches a sequence of consecutive regular expressions.

Instance methods

Generex<T>
And<TOtherGenerex, TOtherGenerexMatch>(GenerexNoResultBase<T, TOtherGenerex, TOtherGenerexMatch> other)
Returns a regular expression that only matches if the subarray matched by this regular expression also contains a match for the specified other regular expression. (see also remarks)
TOtherGenerex
And<TOtherResult, TOtherGenerex, TOtherGenerexMatch>(GenerexWithResultBase<T, TOtherResult, TOtherGenerex, TOtherGenerexMatch> other)
Returns a regular expression that only matches if the subarray matched by this regular expression also contains a match for the specified other regular expression, and if so, associates each match of this regular expression with the result object returned by the other regular expression’s first match. (see also remarks)
Generex<T>
AndExact<TOtherGenerex, TOtherGenerexMatch>(GenerexNoResultBase<T, TOtherGenerex, TOtherGenerexMatch> other)
Returns a regular expression that only matches if the subarray matched by this regular expression also fully matches the specified other regular expression. (see also remarks)
TOtherGenerex
AndExact<TOtherResult, TOtherGenerex, TOtherGenerexMatch>(GenerexWithResultBase<T, TOtherResult, TOtherGenerex, TOtherGenerexMatch> other)
Returns a regular expression that only matches if the subarray matched by this regular expression also fully matches the specified other regular expression, and if so, associates each match of this regular expression with the result object returned by the other regular expression’s match. (see also remarks)
TOtherGenerex
AndReverse<TOtherResult, TOtherGenerex, TOtherGenerexMatch>(GenerexWithResultBase<T, TOtherResult, TOtherGenerex, TOtherGenerexMatch> other)
Returns a regular expression that only matches if the subarray matched by this regular expression also contains a match for the specified other regular expression, and if so, associates each match of this regular expression with the result object returned by the other regular expression’s first match found when matching backwards (starting at the end of the matched subarray). (see also remarks)
Generex<T> Matches this regular expression atomically (without backtracking into it) (cf. (?>...) in traditional regular expression syntax).
Generex<T>
Do(Action<GenerexMatch<T>> code)
Executes the specified code every time the regular expression engine encounters this expression.
bool
IsMatch(T[] input, int startAt = 0)
Determines whether the given input sequence contains a match for this regular expression, optionally starting the search at a specified index.
bool
IsMatchAt(T[] input, int mustStartAt = 0)
Determines whether the given input sequence matches this regular expression at a specific index.
bool
IsMatchExact(T[] input, int mustStartAt = 0, int? mustEndAt = null)
Determines whether the given input sequence matches this regular expression exactly.
bool
IsMatchReverse(T[] input, int? endAt = null)
Determines whether the given input sequence contains a match for this regular expression that ends before the specified maximum index.
bool
IsMatchUpTo(T[] input, int? mustEndAt = null)
Determines whether the given input sequence matches this regular expression up to a specific index.
Generex<T> Turns the current regular expression into a zero-width positive look-ahead assertion (cf. (?=...) in traditional regular expression syntax).
Generex<T> Turns the current regular expression into a zero-width negative look-ahead assertion (cf. (?!...) in traditional regular expression syntax).
Generex<T> Turns the current regular expression into a zero-width positive look-behind assertion (cf. (?<=...) in traditional regular expression syntax).
Generex<T> Turns the current regular expression into a zero-width negative look-behind assertion (cf. (?<!...) in traditional regular expression syntax).
GenerexMatch<T>
Match(T[] input, int startAt = 0)
Determines whether the given input sequence matches this regular expression, and if so, returns information about the first match.
IEnumerable<GenerexMatch<T>>
Matches(T[] input, int startAt = 0)
Returns a sequence of non-overlapping regular expression matches, optionally starting the search at the specified index. (see also remarks)
IEnumerable<GenerexMatch<T>>
MatchesReverse(T[] input, int? endAt = null)
Returns a sequence of non-overlapping regular expression matches going backwards (starting at the end of the specified input sequence), optionally starting the search at the specified index.
GenerexMatch<T>
MatchExact(T[] input, int mustStartAt = 0, int? mustEndAt = null)
Determines whether the given input sequence matches this regular expression exactly, and if so, returns information about the match.
GenerexMatch<T>
MatchReverse(T[] input, int? endAt = null)
Determines whether the given input sequence matches this regular expression, and if so, returns information about the first match found by matching the regular expression backwards (starting from the end of the input sequence).
Generex<T> Returns a regular expression that matches this regular expression zero times or once. Zero times is prioritised (cf. ?? in traditional regular expression syntax).
Generex<T> Returns a regular expression that matches this regular expression zero times or once. Once is prioritised (cf. ? in traditional regular expression syntax).
Generex<T>
Or(T element)
Returns a regular expression that matches either this regular expression or the specified single element (cf. | in traditional regular expression syntax).
Generex<T>
Or(IEnumerable<T> elements)
Returns a regular expression that matches either this regular expression or the specified sequence of elements (cf. | or [...] in traditional regular expression syntax).
Generex<T>
Or(params T[] elements)
Generex<T>
Or(Predicate<T> predicate)
Returns a regular expression that matches either this regular expression or a single element that satisfies the specified predicate (cf. | in traditional regular expression syntax).
Generex<T>
Or(T element, IEqualityComparer<T> comparer)
Returns a regular expression that matches either this regular expression or the specified single element using the specified equality comparer (cf. | in traditional regular expression syntax).
Generex<T>
Or(IEqualityComparer<T> comparer, IEnumerable<T> elements)
Returns a regular expression that matches either this regular expression or the specified sequence of elements using the specified equality comparer (cf. | or [...] in traditional regular expression syntax).
Generex<T>
Or(IEqualityComparer<T> comparer, params T[] elements)
Generex<T>
Or<TOtherGenerex, TOtherGenerexMatch>(GenerexBase<T, int, TOtherGenerex, TOtherGenerexMatch> other)
Returns a regular expression that matches either this regular expression or the specified other regular expression (cf. | in traditional regular expression syntax).
Generex<T, TResult>
Process<TResult>(Func<GenerexMatch<T>, TResult> selector)
Processes each match of this regular expression by running it through a provided selector.
Generex<T> Returns a regular expression that matches this regular expression zero or more times. Fewer times are prioritised (cf. *? in traditional regular expression syntax).
Generex<T>
Repeat(int min)
Returns a regular expression that matches this regular expression the specified number of times or more. Fewer times are prioritised (cf. {min,}? in traditional regular expression syntax).
Generex<T>
Repeat(int min, int max)
Returns a regular expression that matches this regular expression any number of times within specified boundaries. Fewer times are prioritised (cf. {min,max}? in traditional regular expression syntax).
Generex<T> Returns a regular expression that matches this regular expression zero or more times. More times are prioritised (cf. * in traditional regular expression syntax).
Generex<T>
RepeatGreedy(int min)
Returns a regular expression that matches this regular expression the specified number of times or more. More times are prioritised (cf. {min,} in traditional regular expression syntax).
Generex<T>
RepeatGreedy(int min, int max)
Returns a regular expression that matches this regular expression any number of times within specified boundaries. More times are prioritised (cf. {min,max} in traditional regular expression syntax).
Generex<T> Returns a regular expression that matches this regular expression one or more times, interspersed with a separator. Fewer times are prioritised.
Generex<T> Returns a regular expression that matches this regular expression one or more times, interspersed with a separator. More times are prioritised.
T[]
Replace(T[] input, Func<GenerexMatch<T>, IEnumerable<T>> replaceWith, int startAt = 0, int? maxReplace = null)
Replaces each match of this regular expression within the given input sequence with the replacement sequence returned by the given selector.
T[]
Replace(T[] input, IEnumerable<T> replaceWith, int startAt = 0, int? maxReplace = null)
Replaces each match of this regular expression within the given input sequence with a replacement sequence. (see also remarks)
T[]
ReplaceReverse(T[] input, Func<GenerexMatch<T>, IEnumerable<T>> replaceWith, int? endAt = null, int? maxReplace = null)
Replaces each match of this regular expression within the given input sequence, matched from the end backwards, with the replacement sequence returned by the given selector.
T[]
ReplaceReverse(T[] input, IEnumerable<T> replaceWith, int? endAt = null, int? maxReplace = null)
Replaces each match of this regular expression within the given input sequence, matched from the end backwards, with a replacement sequence.
Generex<T>
Then(params T[] elements)
Returns a regular expression that matches this regular expression followed by the specified sequence of elements.
Generex<T>
Then(IEnumerable<T> elements)
Generex<T>
Then(Predicate<T> predicate)
Returns a regular expression that matches this regular expression followed by a single element that satisfies the specified predicate.
Generex<T>
Then(IEqualityComparer<T> comparer, params T[] elements)
Returns a regular expression that matches this regular expression followed by the specified sequence of elements, using the specified equality comparer.
Generex<T>
Then(IEqualityComparer<T> comparer, IEnumerable<T> elements)
Generex<T>
Then<TOtherGenerex, TOtherGenerexMatch>(params GenerexNoResultBase<T, TOtherGenerex, TOtherGenerexMatch>[] other)
Returns a regular expression that matches a consecutive sequence of regular expressions, beginning with this one, followed by the specified ones.
Generex<T>
Then<TOtherGenerex, TOtherGenerexMatch>(IEnumerable<GenerexNoResultBase<T, TOtherGenerex, TOtherGenerexMatch>> other)
TOtherGenerex
Then<TOtherGenerex, TOtherGenerexMatch, TOtherResult>(GenerexWithResultBase<T, TOtherResult, TOtherGenerex, TOtherGenerexMatch> other)
Returns a regular expression that matches this regular expression, followed by the specified other, and retains the result object generated by each match of the other regular expression.
TOtherGenerex
Then<TOtherGenerex, TOtherMatch, TOtherGenerexMatch>(Func<GenerexMatch<T>, GenerexBase<T, TOtherMatch, TOtherGenerex, TOtherGenerexMatch>> selector)
Returns a regular expression that matches this regular expression, then uses a specified selector to create a new regular expression from the match, and then matches the new regular expression. (see also remarks)
Generex<T>
ThenExpect(Func<GenerexMatch<T>, Exception> exceptionGenerator, params T[] elements)
Returns a regular expression that matches this regular expression, then attempts to match the specified sequence of elements and throws an exception if that sequence fails to match. (see also remarks)
Generex<T>
ThenExpect(Func<GenerexMatch<T>, Exception> exceptionGenerator, IEnumerable<T> elements)
Generex<T>
ThenExpect(Predicate<T> predicate, Func<GenerexMatch<T>, Exception> exceptionGenerator)
Returns a regular expression that matches this regular expression, then attempts to match a single element that satisfies the specified predicate and throws an exception if that predicate fails to match. (see also remarks)
Generex<T>
ThenExpect(T element, Func<GenerexMatch<T>, Exception> exceptionGenerator)
Returns a regular expression that matches this regular expression, then attempts to match a single element and throws an exception if that element fails to match. (see also remarks)
Generex<T>
ThenExpect(Func<GenerexMatch<T>, Exception> exceptionGenerator, IEqualityComparer<T> comparer, params T[] elements)
Returns a regular expression that matches this regular expression, then attempts to match the specified sequence of elements using the specified comparer and throws an exception if that sequence fails to match. (see also remarks)
Generex<T>
ThenExpect(Func<GenerexMatch<T>, Exception> exceptionGenerator, IEqualityComparer<T> comparer, IEnumerable<T> elements)
Generex<T>
ThenExpect<TOtherGenerex, TOtherGenerexMatch>(Func<GenerexMatch<T>, Exception> exceptionGenerator, params GenerexNoResultBase<T, TOtherGenerex, TOtherGenerexMatch>[] expectation)
Returns a regular expression that matches this regular expression, then attempts to match the specified sequence of other regular expressions and throws an exception if the sequence fails to match. (see also remarks)
Generex<T>
ThenExpect<TOtherGenerex, TOtherGenerexMatch>(IEnumerable<GenerexNoResultBase<T, TOtherGenerex, TOtherGenerexMatch>> expectation, Func<GenerexMatch<T>, Exception> exceptionGenerator)
Generex<T>
ThenExpect<TOtherGenerex, TOtherGenerexMatch>(GenerexNoResultBase<T, TOtherGenerex, TOtherGenerexMatch> expectation, Func<GenerexMatch<T>, Exception> exceptionGenerator)
Returns a regular expression that matches this regular expression, then attempts to match the specified other regular expression and throws an exception if the sequence fails to match. (see also remarks)
TOtherGenerex
ThenExpect<TOtherGenerex, TOtherResult, TOtherGenerexMatch>(Func<GenerexMatch<T>, GenerexWithResultBase<T, TOtherResult, TOtherGenerex, TOtherGenerexMatch>> selector, Func<GenerexMatch<T>, Exception> exceptionGenerator)
Returns a regular expression that matches this regular expression, then uses a specified selector to create a new regular expression from the match; then attempts to match the new regular expression and throws an exception if that regular expression fails to match. The new regular expression’s result object replaces the current one’s. (see also remarks)
TOtherGenerex
ThenExpect<TOtherGenerex, TOtherGenerexMatch, TOtherResult>(GenerexWithResultBase<T, TOtherResult, TOtherGenerex, TOtherGenerexMatch> expectation, Func<GenerexMatch<T>, Exception> exceptionGenerator)
Returns a regular expression that matches this regular expression, then attempts to match the specified other regular expression and throws an exception if the second regular expression fails to match. (see also remarks)
TOtherGenerex
ThenExpect<TOtherGenerex, TOtherMatch, TOtherGenerexMatch>(Func<GenerexMatch<T>, GenerexBase<T, TOtherMatch, TOtherGenerex, TOtherGenerexMatch>> selector, Func<GenerexMatch<T>, Exception> exceptionGenerator)
Returns a regular expression that matches this regular expression, uses a specified selector to create a new regular expression from the match, attempts to match the new regular expression and throws an exception if the new regular expression fails to match. (see also remarks)
Generex<T>
Throw(Func<GenerexMatch<T>, Exception> exceptionGenerator)
Throws an exception generated by the specified code when the regular expression engine encounters this expression.
Generex<T, TResult>
Throw<TResult>(Func<GenerexMatch<T>, Exception> exceptionGenerator)
Generex<T>
Times(int times)
Returns a regular expression that matches this regular expression the specified number of times (cf. {times} in traditional regular expression syntax).
Generex<T>
Where(Func<GenerexMatch<T>, bool> code)
Restricts matches of this regular expression to those that satisfy the specified predicate.

Static methods

Generex<T, TResult>
AnyOfType<TResult>()
Returns a regular expression that matches a single object of the specified type.
Generex<T>
Not(T element)
Returns a regular expression that matches a single element which is not equal to the specified element.
Generex<T>
Not(params T[] elements)
Returns a regular expression that matches a single element which is none of the specified elements.
Generex<T>
Not(IEqualityComparer<T> comparer, T element)
Returns a regular expression that matches a single element which is not equal to the specified element.
Generex<T>
Not(IEqualityComparer<T> comparer, params T[] elements)
Returns a regular expression that matches a single element which is none of the specified elements.
Generex<T>
Ors(params Generex<T>[] other)
Returns a regular expression that matches any of the specified regular expressions (cf. | in traditional regular expression syntax).
Generex<T>
Ors(IEnumerable<Generex<T>> other)
Generex<T>
Recursive(Func<Generex<T>, Generex<T>> generator)
Generates a recursive regular expression, i.e. one that can contain itself, allowing the matching of arbitrarily nested expressions.

Operators

Generex<T>Returns a regular expression that matches the first regular expression followed by the second.
Generex<T> Returns a regular expression that matches the specified regular expression (first operand) followed by the specified element (second operand).
Generex<T> Returns a regular expression that matches the specified element (first operand) followed by the specified regular expression (second operand).
Generex<T>
operator+(GenerexNoResultBase<T, Generex<T>, GenerexMatch<T>> one, Predicate<T> two)
Returns a regular expression that matches the specified regular expression (first operand) followed by the specified element (second operand).
Generex<T>
operator+(Predicate<T> one, GenerexNoResultBase<T, Generex<T>, GenerexMatch<T>> two)
Returns a regular expression that matches the specified element (first operand) followed by the specified regular expression (second operand).
Generex<T> Returns a regular expression that matches either one of the specified regular expressions (cf. | in traditional regular expression syntax).
Generex<T> Returns a regular expression that matches either the specified regular expression (first operand) or the specified element (second operand) (cf. | in traditional regular expression syntax).
Generex<T> Returns a regular expression that matches either the specified element (first operand) or the specified regular expression (second operand) (cf. | in traditional regular expression syntax).
Generex<T>
operator|(GenerexNoResultBase<T, Generex<T>, GenerexMatch<T>> one, Predicate<T> two)
Returns a regular expression that matches either the specified regular expression (first operand) or a single element that satisfies the specified predicate (second operand) (cf. | in traditional regular expression syntax).
Generex<T>
operator|(Predicate<T> one, GenerexNoResultBase<T, Generex<T>, GenerexMatch<T>> two)
Returns a regular expression that matches either a single element that satisfies the specified predicate (first operand) or the specified regular expression (second operand) (cf. | in traditional regular expression syntax).

Static properties

Generex<T> Returns a regular expression that matches a single element, no matter what it is (cf. . in traditional regular expression syntax).
Generex<T> Returns a regular expression that matches any number of elements, no matter what they are; fewer are prioritized (cf. .*? in traditional regular expression syntax).
Generex<T> Returns a regular expression that matches any number of elements, no matter what they are; more are prioritized (cf. .* in traditional regular expression syntax).
Generex<T> Returns a regular expression that always matches and returns a zero-width match.
Generex<T> Returns a regular expression that matches the end of the input collection (cf. $ in traditional regular expression syntax). Successful matches are always zero length.
Generex<T> Returns a regular expression that never matches (cf. (?!) in traditional regular expression syntax).
Generex<T> Returns a regular expression that matches the beginning of the input collection (cf. ^ in traditional regular expression syntax). Successful matches are always zero length.