Trying to dynamically match a string against a list of strings to find a match, but the input might have slight variations.
Here's an example:
List of titles;
Trying to match "BK III" in list of titles, but in the title, it could be represented as "BKIII" or "BK-III"
If I do something like the following, it works well when there's an exact match, but I'm trying to account for the slight variation
string escapedModelNumber = Regex.Escape(product.ToLower());string pattern = $@"\b{escapedModelNumber}\b"; foreach (string s in titles){ if (Regex.IsMatch(s, pattern, RegexOptions.IgnoreCase)) { return p; }}