using System.Collections.Generic;
using System.Text.RegularExpressions;
public static void Main()
var input = @"<div><strong> hello world </strong><p>hello </p> <i /><i class='fab fa-stack-overflow' /></div>";
var regex = new Regex("(</?([^>/]*)/?>)");
var matches = regex.Matches(input);
var tags = matches.OfType<Match>().Select(m => m.Groups[2].Value);
List<string> whitelistTags = new List<string>() { "strong", "p", "i" };
tags.All(t => whitelistTags.Contains(t.Trim())).Dump();