/// <summary> /// Add an element to match a single carriage return character. /// </summary> /// <param name="quantifier">Quantifier to apply to this element</param> public RegexBuilder CarriageReturn(RegexQuantifier quantifier = null) => AddPart(@"\r", quantifier);
/// <summary> /// Add an element to match a single tab character. /// </summary> /// <param name="quantifier">Quantifier to apply to this element</param> public RegexBuilder Tab(RegexQuantifier quantifier = null) => AddPart(@"\t", quantifier);
/// <summary> /// Add an element to match a single line feed character. /// </summary> /// <param name="quantifier">Quantifier to apply to this element</param> public RegexBuilder LineFeed(RegexQuantifier quantifier = null) => AddPart(@"\n", quantifier);
/// <summary> /// Add an element to match any single non-whitespace character. /// </summary> /// <param name="quantifier">Quantifier to apply to this element</param> public RegexBuilder NonWhitespace(RegexQuantifier quantifier = null) => AddPart(@"\S", quantifier);
/// <summary> /// Add an element to match a single space character. If you want to match any kind of white space, use /// <see cref="Whitespace"/>. /// </summary> /// <param name="quantifier">Quantifier to apply to this element</param> public RegexBuilder Space(RegexQuantifier quantifier = null) => AddPart(" ", quantifier);
/// <summary> /// Add an element (a character class) to match any character except those provided. /// </summary> /// <param name="characters">String containing all characters to exclude from the character class</param> /// <param name="quantifier">Quantifier to apply to this element</param> public RegexBuilder AnyCharacterExcept(string characters, RegexQuantifier quantifier = null) => AddPart("[^" + MakeSafeForCharacterClass(characters) + "]", quantifier);
/// <summary> /// Add an element to match any character. /// </summary> /// <param name="quantifier">Quantifier to apply to this element</param> public RegexBuilder AnyCharacter(RegexQuantifier quantifier = null) => AddPart(".", quantifier);
/// <summary> /// Add an element to match any character that is not a hexadecimal digit (a-f, A-F, 0-9) /// </summary> /// <param name="quantifier">Quantifier to apply to this element</param> public RegexBuilder NonHexDigit(RegexQuantifier quantifier = null) => AddPart("[^0-9A-Fa-f]", quantifier);
/// <summary> /// Add an element to match any character that is not a Unicode letter, decimal digit, or underscore /// </summary> /// <param name="quantifier">Quantifier to apply to this element</param> public RegexBuilder NonWordCharacter(RegexQuantifier quantifier = null) => AddPart(@"[^\p{L}0-9_]", quantifier);
/// <summary> /// Add an element to match any uppercase hexadecimal digit (A-F, 0-9) /// </summary> /// <param name="quantifier">Quantifier to apply to this element</param> public RegexBuilder UppercaseHexDigit(RegexQuantifier quantifier = null) => AddPart("[0-9A-F]", quantifier);
/// <summary> /// Add an element to match any lowercase hexadecimal digit (a-f, 0-9) /// </summary> /// <param name="quantifier">Quantifier to apply to this element</param> public RegexBuilder LowercaseHexDigit(RegexQuantifier quantifier = null) => AddPart("[0-9a-f]", quantifier);
/// <summary> /// Add an element to match any character that is not a Unicode letter or a decimal digit /// </summary> /// <param name="quantifier">Quantifier to apply to this element</param> public RegexBuilder NonLetterOrDigit(RegexQuantifier quantifier = null) => AddPart(@"[^\p{L}0-9]", quantifier);
/// <summary> /// Add an element to match any lowercase Unicode letter /// </summary> /// <param name="quantifier">Quantifier to apply to this element</param> public RegexBuilder LowercaseLetter(RegexQuantifier quantifier = null) => AddPart(@"\p{Ll}", quantifier);
/// <summary> /// Add an element to match any character that is not a Unicode letter /// </summary> /// <param name="quantifier">Quantifier to apply to this element</param> public RegexBuilder NonLetter(RegexQuantifier quantifier = null) => AddPart(@"\P{L}", quantifier);
/// <summary> /// Add an element to match any character that is not a decimal digit (0-9). /// </summary> /// <param name="quantifier">Quantifier to apply to this element</param> public RegexBuilder NonDigit(RegexQuantifier quantifier = null) => AddPart(@"\D", quantifier);
private RegexBuilder EndGroup(RegexQuantifier quantifier = null) => AddPart(")", quantifier);