示例#1
0
        /// <summary> Checks to see if the passed in string is a valid cell name. Valid cell names
        /// consist of one or more letters, followed by a digit 1-9, and zero or more digits 0-9.
        /// </summary> <param name="name"> The possible cell name </param> <param
        /// validChecker="validChecker"> Another regex for limiting possible cell names. </param> A
        /// regex expression that determines additional constraints for cell names. </param>
        /// <returns> True if "name" is a valid cell name. False otherwise. </returns>
        private bool IsValidCellName(String name)
        {
            // A pattern that matches only valid strings.
            string pattern = "^[a-zA-Z][1-9]([0-9]*)?$";
            Regex  r       = new Regex(pattern);

            // Check to see if the cell name is valid to our base rules and to the other rules
            // applied by the additional rules Regex.
            return(r.IsMatch(name) && IsValid.IsMatch(name.ToUpper()));
        }