I have an array with different words and phrases. The user will input a spam message and I'm supposed to check whether there are any matches to the words and phrases already in the array. For each match the score will +1 and if the score is more than 5 then the possibility of it being a spam message is Yes.
My score doesn't increase though and I'm not sure why.
string[] spam = new string[] {"-different words and phrases provided by programmer"};
Console.Write("Key in an email message: ");
string email = Console.ReadLine();
int score = 0;
string pattern = "^\\[a-zA-Z]";
Regex expression = new Regex(pattern);
var regexp = new System.Text.RegularExpressions.Regex(pattern);
if (!regexp.IsMatch(email))
{
score += 1;
}
Aucun commentaire:
Enregistrer un commentaire