Legend

Class
Struct
Enum
Interface
Delegate
Constructor
Method
Property
Event
Field

Method: TGenerex ThenExpect(Predicate<T>, Func<TGenerexMatch, Exception>)

  • Declared in: RT.Generexes.GenerexBase<T, TMatch, TGenerex, TGenerexMatch>

Declaration

public TGenerex ThenExpect(
    Predicate<T> predicate,
    Func<TGenerexMatch, Exception> exceptionGenerator
)

Summary

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.

Parameters

Predicate<T>predicate The predicate that is expected to match one element after the current regular expression.
Func<TGenerexMatch, Exception>exceptionGenerator A selector which, in case of no match, generates the exception object to be thrown.

Returns

The resulting regular expression.

Remarks

Regular expressions created by this method cannot match backwards. The full set of affected methods is listed at GenerexBase<T, TMatch, TGenerex, TGenerexMatch>.Then<TOtherGenerex, TOtherMatch, TOtherGenerexMatch>(Func<TGenerexMatch, GenerexBase<T, TOtherMatch, TOtherGenerex, TOtherGenerexMatch>>).