private static PatternScanResult ComplexFindKeyword(this Pattern self, string text, int startPosition) { PatternScanResult res; while (true) { res = self.ComplexFind(text, startPosition); if (res.Token == "") return res; if (self.CharIsSeparator(text, res.Index - 1) && self.CharIsSeparator(text, res.Index + res.Token.Length)) return res; startPosition = res.Index + 1; if (startPosition >= text.Length) { res.Token = ""; res.Index = 0; return res; } } }
/// <summary> /// For public use only /// </summary> /// <param name="self"></param> /// <param name="text"></param> /// <param name="position"></param> /// <returns></returns> public static bool HasSeparators(this Pattern self,string text, int position) { return (self.CharIsSeparator(text, position - 1) && self.CharIsSeparator(text, position + self.StringPattern.Length)); }