Esempio n. 1
0
        /// <summary>
        /// Character range: Matches any single decimal digit in the range from <paramref name="first"/> to <paramref name="last"/>.
        /// Pattern: "[first-last]".
        /// </summary>
        /// <param name="first">The first digit in the range.</param>
        /// <param name="last">The last digit in the range.</param>
        /// <exception cref="ArgumentException"><paramref name="first"/> is greater as <paramref name="last"/>.</exception>
        /// <exception cref="ArgumentOutOfRangeException"><paramref name="first"/> or <paramref name="last"/> are greater as 9.</exception>
        /// <returns>Current instance of <see cref="Pattern"/>.</returns>
        public Pattern Range(uint first, uint last)
        {
            var group = new PositiveCharacterGroup(first, last);

            return(Add(group.ToString(), false));
        }
Esempio n. 2
0
        /// <summary>
        /// Matches any single character in <paramref name="set"/>. By default, the match is case-sensitive.
        /// Pattern: "[^set]".
        /// </summary>
        /// <param name="set">The set of characters to be matched.</param>
        /// <exception cref="ArgumentNullException"><paramref name="set"/> is <see langword="null"/></exception>
        /// <exception cref="ArgumentOutOfRangeException"><paramref name="set"/> is empty.</exception>
        /// <returns>Current instance of <see cref="Pattern"/>.</returns>
        public Pattern AnyIn(params char[] set)
        {
            var group = new PositiveCharacterGroup(set);

            return(Add(group.ToString(), false));
        }
Esempio n. 3
0
        /// <summary>
        /// Character range: Matches any single character in the range from <paramref name="first"/> to <paramref name="last"/>.
        /// Pattern: "[first-last]".
        /// </summary>
        /// <param name="first">The first character in the range.</param>
        /// <param name="last">The last character in the range.</param>
        /// <param name="caseSensitive">If it must be case-sensitive.</param>
        /// <exception cref="ArgumentException"><paramref name="first"/> is greater as <paramref name="last"/>.</exception>
        /// <returns>Current instance of <see cref="Pattern"/>.</returns>
        public Pattern Range(char first, char last, bool caseSensitive = true)
        {
            var group = new PositiveCharacterGroup(first, last, caseSensitive);

            return(Add(group.ToString(), false));
        }
Esempio n. 4
0
        /// <summary>
        /// Matches any single character in <paramref name="set"/>. By default, the match is case-sensitive.
        /// Pattern: "[set]".
        /// </summary>
        /// <param name="set">The set of characters to be matched.</param>
        /// <param name="escape">Indicates whether the character set (\, *, +, ?, |, {, [, (,), ^, $, ., #, and white space) should be replaced with their escape codes.</param>
        /// <exception cref="ArgumentNullException"><paramref name="set"/> is <see langword="null"/></exception>
        /// <exception cref="ArgumentOutOfRangeException"><paramref name="set"/> is <see cref="string.Empty"/>.</exception>
        /// <returns>Current instance of <see cref="Pattern"/>.</returns>
        public Pattern AnyIn(string set, bool escape = true)
        {
            var group = new PositiveCharacterGroup(set, escape);

            return(Add(group.ToString(), false));
        }