private IGroup ParseCaptureGroup(string name, bool useQuotes) { RegisterGroupName(name); var options = new CaptureGroupOptions() { Name = name, UseQuotes = useQuotes }; var item = Parse(); return(CaptureGroup.Of(options, item)); }
/// <summary> /// Creates a new group that captures its subexpressions by number or name (optional). /// </summary> /// <param name="options">The capture group options to use -or- null, if no options are provided.</param> /// <param name="members">The sub-expressions appearing in the group.</param> /// <returns>The capture group.</returns> public static ICaptureGroup From(CaptureGroupOptions options, IEnumerable <IExpression> members) { if (members == null) { throw new ArgumentNullException(nameof(members)); } var group = new CaptureGroup(); if (options != null) { string name = String.IsNullOrWhiteSpace(options.Name) ? null : options.Name; ValidateCaptureGroupName(nameof(options), name); group.Name = name; group.UseQuotes = options.UseQuotes; } foreach (var member in members) { group.Add(member); } return(group); }