using System.Collections.Generic;
public static void Main()
string searchTerm = "The Lord Of The Rings";
searchTerm = NormalizeWhiteSpacesAndPunctuations(searchTerm);
List<string> films = new List<string>() { "Harry Potter", "Avangers", "The Lord Of The Rings", "Back to the future" };
.FirstOrDefault(film => NormalizeWhiteSpacesAndPunctuations(film).IndexOf(searchTerm, StringComparison.OrdinalIgnoreCase) >= 0);
static string NormalizeWhiteSpacesAndPunctuations(string text)
if (string.IsNullOrWhiteSpace(text))
StringBuilder sb = new StringBuilder(text.Length);
bool lastCharWasSpace = false;
if (char.IsWhiteSpace(c) || char.IsPunctuation(c))
lastCharWasSpace = false;
return sb.ToString().Trim();