Beispiel #1
0
        private List <SpamMatch> Find(Regex find_data, string text, PlaceMatches placeMatches)
        {
            List <SpamMatch> ret_val = new List <SpamMatch>();
            SpamMatch        match   = new SpamMatch()
            {
                LevelMatch = FindLevel, PlaceMatch = placeMatches, TypeMatch = TypeMatches.Regex, find_data = find_data.ToString()
            };

            foreach (Match m in find_data.Matches(text))
            {
                match.index = m.Index;
                ret_val.Add(match.Clone());
            }
            return(ret_val);
        }
Beispiel #2
0
        private List <SpamMatch> Find(string find_data, string text, PlaceMatches placeMatches)
        {
            List <SpamMatch> ret_val = new List <SpamMatch>();

            if (string.IsNullOrEmpty(find_data) || string.IsNullOrEmpty(text) || find_data.Length > text.Length)
            {
                return(ret_val);
            }

            SpamMatch match = new SpamMatch()
            {
                LevelMatch = FindLevel, PlaceMatch = placeMatches, TypeMatch = TypeMatches.Text, find_data = find_data
            };
            int start_index = 0;

            while (text.IndexOf(find_data, start_index) >= 0)
            {
                match.index = text.IndexOf(find_data, start_index);
                ret_val.Add(match.Clone());
                start_index = match.index + 1;
            }

            return(ret_val);
        }