Example #1
0
        /// <summary>
        /// Returns the index of the pattern in a string
        /// </summary>
        /// <param name="self"></param>
        /// <param name="text">The string in which to find the pattern</param>
        /// <param name="startPosition">Start index in the string</param>
        /// <param name="matchCase">true if a case sensitive match should be performed</param>
        /// <param name="separators"></param>
        /// <returns>A PatternScanResult containing information on where the pattern was found and also the text of the pattern</returns>
        public static PatternScanResult IndexIn(this Pattern self, string text, int startPosition, bool matchCase, string separators)
        {
            if (separators == null)
            {
            }
            else
            {
                self.Separators = separators;
            }

            if (!self.IsComplex)
            {
                if (!self.IsKeyword)
                {
                    return(self.SimpleFind(text, startPosition, matchCase));
                }

                return(self.SimpleFindKeyword(text, startPosition, matchCase));
            }
            if (!self.IsKeyword)
            {
                return(self.ComplexFind(text, startPosition));
            }

            return(self.ComplexFindKeyword(text, startPosition));
        }