/// <summary> /// Concatenate two elements into a new <see cref="Substitution"/>. /// </summary> /// <param name="left">The first element to concatenate.</param> /// <param name="right">The second element to concatenate.</param> /// <exception cref="ArgumentNullException"><paramref name="right"/> is <c>null</c>.</exception> public static Substitution operator +(char left, Substitution right) { if (right == null) { throw new ArgumentNullException(nameof(right)); } return(Substitutions.Text(left).Append(right)); }
/// <summary> /// Concatenate two elements into a new <see cref="Substitution"/>. /// </summary> /// <param name="left">The first element to concatenate.</param> /// <param name="right">The second element to concatenate.</param> /// <exception cref="ArgumentNullException"><paramref name="left"/> is <c>null</c>.</exception> public static Substitution operator +(Substitution left, char right) { if (left == null) { throw new ArgumentNullException(nameof(left)); } return(left.Append(Substitutions.Text(right))); }
/// <summary> /// Appends a substitution pattern that substitutes all the text of the input string after the match. /// </summary> public Substitution AfterMatch() => Append(Substitutions.AfterMatch());
/// <summary> /// Appends a substitution pattern that substitutes the entire match. /// </summary> public Substitution EntireMatch() => Append(Substitutions.EntireMatch());
/// <summary> /// Appends a substitution pattern that substitutes the entire input string. /// </summary> public Substitution EntireInput() => Append(Substitutions.EntireInput());
/// <summary> /// Appends a substitution pattern that substitutes the last captured group. /// </summary> public Substitution LastCapturedGroup() => Append(Substitutions.LastCapturedGroup());
/// <summary> /// Appends a substitution pattern that substitutes the last substring matched by the named group. /// </summary> /// <param name="groupName">Valid regex group name.</param> /// <exception cref="ArgumentNullException"><paramref name="groupName"/> is <c>null</c>.</exception> /// <exception cref="ArgumentException"><paramref name="groupName"/> is not a valid regex group name.</exception> public Substitution NamedGroup(string groupName) => Append(Substitutions.NamedGroup(groupName));
/// <summary> /// Appends a substitution pattern that substitutes the last substring matched by the numbered or named group. /// </summary> /// <param name="groupNumber">A number of the group.</param> /// <exception cref="ArgumentOutOfRangeException"><paramref name="groupNumber"/> is less than zero.</exception> public Substitution Group(int groupNumber) => Append(Substitutions.Group(groupNumber));
/// <summary> /// Appends a specified character to the substitution pattern. /// </summary> /// <param name="value">A Unicode character to append.</param> public Substitution Text(char value) => Append(Substitutions.Text(value));
/// <summary> /// Appends a specified text to the substitution pattern. /// </summary> /// <param name="value">A text to append.</param> public Substitution Text(string value) => Append(Substitutions.Text(value));
/// <summary> /// Appends a substitution pattern that substitutes all the text of the input string before the match. /// </summary> public Substitution BeforeMatch() => Append(Substitutions.BeforeMatch());