示例#1
0
        /// <summary>
        /// Attempts to match the input string against the pattern.
        /// To succeed, the match must extend to the end of the string,
        /// or cover the complete match region.
        ///
        /// If startIndex >= zero the match operation starts at the specified
        /// index and must extend to the end of the input string.  Any region
        /// that has been specified is reset.
        ///
        /// If startIndex = -1 the match must cover the input region, or the entire
        /// input string if no region has been set.This directly corresponds to
        /// Matcher.matches() in Java
        /// </summary>
        /// <param name="startIndex">The input string (native) index at which to begin
        ///              matching, or -1 to match the input Region.</param>
        /// <returns>true if match suceeds; false, otherwise.</returns>
        public bool Matches(int startIndex)
        {
            ErrorCode errorCode;
            bool      result;

            result = NativeMethods.uregex_matches(_regexMatcher, startIndex, out errorCode);
            if (errorCode.IsFailure())
            {
                throw new Exception("Match failed");
            }
            return(result);
        }