Example #1
0
        /// <summary>
        /// Performs a wildcard (*,?) search returning true if the text satisfies one of the provided pattern contained in the patternList
        /// </summary>
        /// <param name="text"></param>
        /// <param name="patternList"></param>
        /// <param name="caseSensitive"></param>
        /// <returns></returns>
        public static bool IsLike(string text, string[] patternList, bool caseSensitive)
        {
            bool isItemMatched = false;

            foreach (string patternItem in patternList)
            {
                if (WildcardHelper.IsLike(text, patternItem))
                {
                    isItemMatched = true;
                    break;
                }
            }
            return(isItemMatched);
        }
Example #2
0
        /// <summary>
        /// Performs a wildcard (*,?) search returning true if the text satisfies the provided pattern
        /// </summary>
        /// <param name="text">The source expression</param>
        /// <param name="pattern">The pattern containing the wildcard characters</param>
        /// <param name="caseSensitive">True to perform a case sensitive search</param>
        /// <returns></returns>
        public static bool IsLike(string text, string pattern, bool caseSensitive)
        {
            WildcardHelper wildcard = new WildcardHelper(pattern, caseSensitive ? RegexOptions.None : RegexOptions.IgnoreCase);

            return(wildcard.IsMatch(text));
        }