/// <summary> /// Generates a regular expression that matches the specified regular expressions in any order.</summary> /// <param name="stringerexes"> /// The regular expressions to match.</param> public static Stringerex InAnyOrder(params Stringerex[] stringerexes) { if (stringerexes == null) { throw new ArgumentNullException("stringerexes"); } return(Generex.InAnyOrder <Stringerex, Stringerex>( thenner: (prev, next) => prev.Then(next), orer: (one, two) => one.Or(two), constructor: () => new Stringerex(), generexes: stringerexes)); }
/// <summary> /// Generates a regular expression that matches the specified regular expressions in any order.</summary> /// <typeparam name="TResult"> /// Type of the result object associated with each match of the regular expression.</typeparam> /// <param name="stringerexes"> /// The regular expressions to match.</param> public static Stringerex <IEnumerable <TResult> > InAnyOrder <TResult>(params Stringerex <TResult>[] stringerexes) { if (stringerexes == null) { throw new ArgumentNullException("stringerexes"); } return(Generex.InAnyOrder <Stringerex <TResult>, Stringerex <IEnumerable <TResult> > >( thenner: (prev, next) => prev.ThenRaw(next, InternalExtensions.Concat), orer: (one, two) => one.Or(two), constructor: () => new Stringerex <IEnumerable <TResult> >(Enumerable.Empty <TResult>()), generexes: stringerexes)); }
/// <summary> /// Generates a regular expression that matches the characters of the specified string in any order.</summary> /// <param name="characters"> /// A string containing the characters to match.</param> /// <param name="comparer"> /// The optional equality comparer to use to determine matching characters.</param> public static Stringerex InAnyOrder(string characters, IEqualityComparer <char> comparer = null) { if (characters == null) { throw new ArgumentNullException("characters"); } comparer = comparer ?? EqualityComparer <char> .Default; return(Generex.InAnyOrder <Stringerex, Stringerex>( thenner: (prev, next) => prev.Then(next), orer: (one, two) => one.Or(two), constructor: () => new Stringerex(), generexes: characters.Select(ch => new Stringerex(ch, comparer)).ToArray())); }