Legend

Class
Struct
Enum
Interface
Delegate
Constructor
Method
Property
Event
Field

Sealed class: RT.Generexes.Stringerex

Summary

Provides regular-expression functionality for strings.

Constructors

Instantiates an empty regular expression (always matches).
Stringerex(char ch)
Instantiates a regular expression that matches a specified character.
Stringerex(string elements)
Instantiates a regular expression that matches a sequence of consecutive characters.
Stringerex(IEnumerable<char> elements)
Stringerex(char ch, IEqualityComparer<char> comparer)
Instantiates a regular expression that matches a specified character using the specified optional equality comparer.
Stringerex(string elements, IEqualityComparer<char> comparer)
Instantiates a regular expression that matches a sequence of consecutive characters using the specified optional equality comparer.
Stringerex(IEnumerable<char> elements, IEqualityComparer<char> comparer)
Stringerex(Predicate<char> predicate)
Instantiates a regular expression that matches a single character that satisfies the given predicate (cf. [...] in traditional regular expression syntax).
Stringerex(Func<string, int, bool> charPredicate)
Instantiates a regular expression that matches a single Unicode character according to a predicate that takes a string and index, such as char.IsWhiteSpace (cf. [...] in traditional regular expression syntax).
Stringerex(UnicodeCategory category)
Instantiates a regular expression that matches a single Unicode character of a specific Unicode character (cf. [...] in traditional regular expression syntax).
Stringerex(params Stringerex[] generexSequence)
Instantiates a regular expression that matches a sequence of consecutive regular expressions.

Instance methods

Stringerex
And<TOtherGenerex, TOtherGenerexMatch>(GenerexNoResultBase<char, 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<char, 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)
Stringerex
AndExact<TOtherGenerex, TOtherGenerexMatch>(GenerexNoResultBase<char, 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<char, 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<char, 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)
Stringerex Matches this regular expression atomically (without backtracking into it) (cf. (?>...) in traditional regular expression syntax).
Stringerex
Do(Action<StringerexMatch> code)
Executes the specified code every time the regular expression engine encounters this expression.
bool
IsMatch(string input, int startAt = 0)
Determines whether the given string contains a match for this regular expression, optionally starting the search at a specified character index.
bool
IsMatch(char[] 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(string input, int mustStartAt = 0)
Determines whether the given string matches this regular expression at a specific character index.
bool
IsMatchAt(char[] input, int mustStartAt = 0)
Determines whether the given input sequence matches this regular expression at a specific index.
bool
IsMatchExact(string input, int mustStartAt = 0, int? mustEndAt = null)
Determines whether the given string matches this regular expression exactly.
bool
IsMatchExact(char[] input, int mustStartAt = 0, int? mustEndAt = null)
Determines whether the given input sequence matches this regular expression exactly.
bool
IsMatchReverse(string input, int? endAt = null)
Determines whether the given string contains a match for this regular expression that ends before the specified maximum character index.
bool
IsMatchReverse(char[] 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(string input, int? mustEndAt = null)
Determines whether the given string matches this regular expression up to a specific character index.
bool
IsMatchUpTo(char[] input, int? mustEndAt = null)
Determines whether the given input sequence matches this regular expression up to a specific index.
Stringerex Turns the current regular expression into a zero-width positive look-ahead assertion (cf. (?=...) in traditional regular expression syntax).
Stringerex Turns the current regular expression into a zero-width negative look-ahead assertion (cf. (?!...) in traditional regular expression syntax).
Stringerex Turns the current regular expression into a zero-width positive look-behind assertion (cf. (?<=...) in traditional regular expression syntax).
Stringerex Turns the current regular expression into a zero-width negative look-behind assertion (cf. (?<!...) in traditional regular expression syntax).
StringerexMatch
Match(string input, int startAt = 0)
Determines whether the given string matches this regular expression, and if so, returns information about the first match.
StringerexMatch
Match(char[] input, int startAt = 0)
Determines whether the given input sequence matches this regular expression, and if so, returns information about the first match.
IEnumerable<StringerexMatch>
Matches(string input, int startAt = 0)
Returns a sequence of non-overlapping regular expression matches, optionally starting the search at the specified character index. (see also remarks)
IEnumerable<StringerexMatch>
Matches(char[] 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<StringerexMatch>
MatchesReverse(string input, int? endAt = null)
Returns a sequence of non-overlapping regular expression matches going backwards (starting at the end of the specified string), optionally starting the search at the specified index.
IEnumerable<StringerexMatch>
MatchesReverse(char[] 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.
StringerexMatch
MatchExact(string input, int mustStartAt = 0, int? mustEndAt = null)
Determines whether the given string matches this regular expression exactly, and if so, returns information about the match.
StringerexMatch
MatchExact(char[] 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.
StringerexMatch
MatchReverse(string input, int? endAt = null)
Determines whether the given string 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 string).
StringerexMatch
MatchReverse(char[] 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).
Stringerex Returns a regular expression that matches this regular expression zero times or once. Zero times is prioritised (cf. ?? in traditional regular expression syntax).
Stringerex Returns a regular expression that matches this regular expression zero times or once. Once is prioritised (cf. ? in traditional regular expression syntax).
Stringerex
Or(char element)
Returns a regular expression that matches either this regular expression or the specified single element (cf. | in traditional regular expression syntax).
Stringerex
Or(IEnumerable<char> elements)
Returns a regular expression that matches either this regular expression or the specified sequence of elements (cf. | or [...] in traditional regular expression syntax).
Stringerex
Or(params char[] elements)
Stringerex
Or(Predicate<char> 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).
Stringerex
Or(string str, IEqualityComparer<char> comparer = null)
Returns a regular expression that matches either this regular expression or the specified string using the specified equality comparer (cf. | or [...] in traditional regular expression syntax).
Stringerex
Or(char element, IEqualityComparer<char> 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).
Stringerex
Or(IEqualityComparer<char> comparer, IEnumerable<char> 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).
Stringerex
Or(IEqualityComparer<char> comparer, params char[] elements)
Stringerex
Or<TOtherGenerex, TOtherGenerexMatch>(GenerexBase<char, 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).
Stringerex<TResult>
Process<TResult>(Func<StringerexMatch, TResult> selector)
Processes each match of this regular expression by running it through a provided selector.
Stringerex Returns a regular expression that matches this regular expression zero or more times. Fewer times are prioritised (cf. *? in traditional regular expression syntax).
Stringerex
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).
Stringerex
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).
Stringerex Returns a regular expression that matches this regular expression zero or more times. More times are prioritised (cf. * in traditional regular expression syntax).
Stringerex
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).
Stringerex
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).
Stringerex Returns a regular expression that matches this regular expression one or more times, interspersed with a separator. Fewer times are prioritised.
Stringerex Returns a regular expression that matches this regular expression one or more times, interspersed with a separator. More times are prioritised.
char[]
Replace(char[] input, Func<StringerexMatch, IEnumerable<char>> 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.
char[]
Replace(char[] input, IEnumerable<char> 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)
char[]
ReplaceReverse(char[] input, Func<StringerexMatch, IEnumerable<char>> 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.
char[]
ReplaceReverse(char[] input, IEnumerable<char> 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.
Stringerex
Then(params char[] elements)
Returns a regular expression that matches this regular expression followed by the specified sequence of elements.
Stringerex
Then(IEnumerable<char> elements)
Stringerex
Then(Predicate<char> predicate)
Returns a regular expression that matches this regular expression followed by a single element that satisfies the specified predicate.
Stringerex
Then(string str, IEqualityComparer<char> comparer = null)
Returns a regular expression that matches this regular expression followed by the specified string, using the specified equality comparer.
Stringerex
Then(IEqualityComparer<char> comparer, params char[] elements)
Returns a regular expression that matches this regular expression followed by the specified sequence of elements, using the specified equality comparer.
Stringerex
Then(IEqualityComparer<char> comparer, IEnumerable<char> elements)
Stringerex
Then<TOtherGenerex, TOtherGenerexMatch>(params GenerexNoResultBase<char, TOtherGenerex, TOtherGenerexMatch>[] other)
Returns a regular expression that matches a consecutive sequence of regular expressions, beginning with this one, followed by the specified ones.
Stringerex
Then<TOtherGenerex, TOtherGenerexMatch>(IEnumerable<GenerexNoResultBase<char, TOtherGenerex, TOtherGenerexMatch>> other)
TOtherGenerex
Then<TOtherGenerex, TOtherGenerexMatch, TOtherResult>(GenerexWithResultBase<char, 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<StringerexMatch, GenerexBase<char, 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)
Stringerex
ThenExpect(Func<StringerexMatch, Exception> exceptionGenerator, params char[] 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)
Stringerex
ThenExpect(Func<StringerexMatch, Exception> exceptionGenerator, IEnumerable<char> elements)
Stringerex
ThenExpect(Predicate<char> predicate, Func<StringerexMatch, 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)
Stringerex
ThenExpect(char element, Func<StringerexMatch, 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)
Stringerex
ThenExpect(Func<StringerexMatch, Exception> exceptionGenerator, IEqualityComparer<char> comparer, params char[] 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)
Stringerex
ThenExpect(Func<StringerexMatch, Exception> exceptionGenerator, IEqualityComparer<char> comparer, IEnumerable<char> elements)
Stringerex
ThenExpect<TOtherGenerex, TOtherGenerexMatch>(Func<StringerexMatch, Exception> exceptionGenerator, params GenerexNoResultBase<char, 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)
Stringerex
ThenExpect<TOtherGenerex, TOtherGenerexMatch>(IEnumerable<GenerexNoResultBase<char, TOtherGenerex, TOtherGenerexMatch>> expectation, Func<StringerexMatch, Exception> exceptionGenerator)
Stringerex
ThenExpect<TOtherGenerex, TOtherGenerexMatch>(GenerexNoResultBase<char, TOtherGenerex, TOtherGenerexMatch> expectation, Func<StringerexMatch, 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<StringerexMatch, GenerexWithResultBase<char, TOtherResult, TOtherGenerex, TOtherGenerexMatch>> selector, Func<StringerexMatch, 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<char, TOtherResult, TOtherGenerex, TOtherGenerexMatch> expectation, Func<StringerexMatch, 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<StringerexMatch, GenerexBase<char, TOtherMatch, TOtherGenerex, TOtherGenerexMatch>> selector, Func<StringerexMatch, 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)
Stringerex
Throw(Func<StringerexMatch, Exception> exceptionGenerator)
Throws an exception generated by the specified code when the regular expression engine encounters this expression.
Stringerex<TResult>
Throw<TResult>(Func<StringerexMatch, Exception> exceptionGenerator)
Stringerex
Times(int times)
Returns a regular expression that matches this regular expression the specified number of times (cf. {times} in traditional regular expression syntax).
Stringerex
Where(Func<StringerexMatch, bool> code)
Restricts matches of this regular expression to those that satisfy the specified predicate.

Static methods

Stringerex
Expect(Stringerex stringerex, Func<StringerexMatch, Exception> exceptionGenerator)
Attempts to match the specified regular expression and throws an exception generated by the specified code if the regular expression does not match.
Stringerex
Expect(Stringerex[] stringerexes, Func<StringerexMatch, Exception> exceptionGenerator)
Attempts to match the specified sequence of consecutive regular expressions and throws an exception generated by the specified code if the regular expression does not match.
Stringerex
Expect(Predicate<char> predicate, Func<StringerexMatch, Exception> exceptionGenerator)
Attempts to match an element with the specified predicate and throws an exception generated by the specified code if the regular expression does not match.
Stringerex
Expect(char element, Func<StringerexMatch, Exception> exceptionGenerator)
Attempts to match the specified character and throws an exception generated by the specified code if the regular expression does not match.
Stringerex
Expect(string elements, Func<StringerexMatch, Exception> exceptionGenerator)
Attempts to match the specified string and throws an exception generated by the specified code if the regular expression does not match.
Stringerex
Expect(IEnumerable<char> elements, Func<StringerexMatch, Exception> exceptionGenerator)
Attempts to match the specified sequence of characters and throws an exception generated by the specified code if the regular expression does not match.
Stringerex
Expect(char element, IEqualityComparer<char> comparer, Func<StringerexMatch, Exception> exceptionGenerator)
Attempts to match the specified character using the specified comparer and throws an exception generated by the specified code if the regular expression does not match.
Stringerex
Expect(string elements, IEqualityComparer<char> comparer, Func<StringerexMatch, Exception> exceptionGenerator)
Attempts to match the specified string using the specified character comparer and throws an exception generated by the specified code if the regular expression does not match.
Stringerex
Expect(IEnumerable<char> elements, IEqualityComparer<char> comparer, Func<StringerexMatch, Exception> exceptionGenerator)
Attempts to match the specified sequence of characters using the specified character comparer and throws an exception generated by the specified code if the regular expression does not match.
Stringerex<TResult>
Expect<TResult>(Stringerex<TResult> stringerex, Func<StringerexMatch, Exception> exceptionGenerator)
Attempts to match the specified regular expression and throws an exception generated by the specified code if the regular expression does not match.
Stringerex
InAnyOrder(params Stringerex[] stringerexes)
Generates a regular expression that matches the specified regular expressions in any order.
Stringerex
InAnyOrder(string characters, IEqualityComparer<char> comparer = null)
Generates a regular expression that matches the characters of the specified string in any order.
Stringerex<IEnumerable<TResult>>
InAnyOrder<TResult>(params Stringerex<TResult>[] stringerexes)
Generates a regular expression that matches the specified regular expressions in any order.
Stringerex
Not(char element)
Returns a regular expression that matches a single element which is not equal to the specified element.
Stringerex
Not(params char[] elements)
Returns a regular expression that matches a single element which is none of the specified elements.
Stringerex
Not(IEqualityComparer<char> comparer, char element)
Returns a regular expression that matches a single element which is not equal to the specified element.
Stringerex
Not(IEqualityComparer<char> comparer, params char[] elements)
Returns a regular expression that matches a single element which is none of the specified elements.
Stringerex
Ors(params Stringerex[] other)
Returns a regular expression that matches any of the specified regular expressions (cf. | in traditional regular expression syntax).
Stringerex
Ors(IEnumerable<Stringerex> other)
Stringerex
Recursive(Func<Stringerex, Stringerex> generator)
Generates a recursive regular expression, i.e. one that can contain itself, allowing the matching of arbitrarily nested expressions.
Stringerex<TResult>
Recursive<TResult>(Func<Stringerex<TResult>, Stringerex<TResult>> generator)

Operators

StringerexReturns a regular expression that matches the first regular expression followed by the second.
Stringerex Returns a regular expression that matches the specified regular expression (first operand) followed by the specified element (second operand).
Stringerex Returns a regular expression that matches the specified element (first operand) followed by the specified regular expression (second operand).
Stringerex
operator+(GenerexNoResultBase<char, Stringerex, StringerexMatch> one, Predicate<char> two)
Returns a regular expression that matches the specified regular expression (first operand) followed by the specified element (second operand).
Stringerex
operator+(Predicate<char> one, GenerexNoResultBase<char, Stringerex, StringerexMatch> two)
Returns a regular expression that matches the specified element (first operand) followed by the specified regular expression (second operand).
Stringerex
operator|(Stringerex one, Generex<char> two)
Returns a regular expression that matches either one of the specified regular expressions (cf. | in traditional regular expression syntax).
Stringerex
operator|(Generex<char> one, Stringerex two)
Stringerex
Stringerex 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).
Stringerex 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).
Stringerex
operator|(GenerexNoResultBase<char, Stringerex, StringerexMatch> one, Predicate<char> 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).
Stringerex
operator|(Predicate<char> one, GenerexNoResultBase<char, Stringerex, StringerexMatch> 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).
StringerexImplicitly converts a character into a regular expression that matches just that character.
StringerexImplicitly converts a string into a regular expression that matches that string.
Stringerex
implicit operator Stringerex(Predicate<char> predicate)
Implicitly converts a predicate into a regular expression that matches a single character satisfying the predicate.

Static properties

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