using System.Collections.Generic;
using System.Text.RegularExpressions;
public static void Main()
var input = "sasasa: 'On Hold' Sender: Classvaluation <br> Delivery to class <br/> has failed from \r\n Event 'On Hold' deb\r\neria <div>de</div> On Hold";
var noHtml = Regex.Replace(input, "<.*?>", string.Empty);
var cleanString = Regex.Replace(noHtml, @"\r\n|\r|\n", " ");
string userPattern = "*Event 'On Hold'*";
string regexPattern = userPattern;
if (userPattern.StartsWith("*") && userPattern.EndsWith("*"))
regexPattern = ".*" + userPattern.Substring(1, userPattern.Length - 2) + ".*";
else if (userPattern.StartsWith("*"))
regexPattern = ".*" + userPattern.Substring(1) + "$";
else if (userPattern.EndsWith("*"))
regexPattern = "^" + userPattern.Substring(0, userPattern.Length - 1) + ".*";
regexPattern = "^" + userPattern + "$";
if (Regex.IsMatch(cleanString, regexPattern))
Console.WriteLine("La cadena coincide con el patrón.");
Console.WriteLine("La cadena no coincide con el patrón.");
Console.WriteLine(cleanString);