Function to exclude specific tags from xml string
<p>I have given XML string with a list of html tag like "<code>&lt;p&gt;, &lt;a&gt;, &lt;img&gt;, &lt;link&gt;</code>" etc.</p>

<p>Now I want to make generic function where I will be passing the list of html tags or can be one tag as well which I want to exclude from the passed XML string. Function will return the whole string back without excluded tags.</p>

<pre><code>  public const String[] htmlTags = new String[] { "&lt;p&gt;", "a", "img" };
  string result = strString.ExcludeHTMLTags(htmlTags); //I will write the String extension not an issue, please suggest how to exclude tags from exisiting string.
</code></pre>

<p>EDIT:</p>

<p>I am trying below code:</p>

<pre><code>/// &lt;summary&gt;
/// Remove HTML tags from string using char array.
/// &lt;/summary&gt;
public static string StripTagsCharArray(string source, String[] htmlTags)
{
    char[] array = new char[source.Length];
    int arrayIndex = 0;
    bool inside = false;

    for (int i = 0; i &lt; source.Length; i++)
    {
        foreach (String htmlTag in htmlTags)
        {
            char let = source[i];
            String tag = "&lt;" + "htmlTag"; //How to handle this as this is character
            if (let == tag)
            {
                inside = true;
                continue;
            }
            if (let == '&gt;')
            {
                inside = false;
                continue;
            }
            if (!inside)
            {
                array[arrayIndex] = let;
                arrayIndex++;
            }
        }
    }
    return new string(array, 0, arrayIndex);
}
</code></pre>

<p>EDIT 2: Using Regex</p>

<pre><code>String[] htmlTags = new String[] { "a", "img", "p" };
private const string STR_RemoveHtmlTagRegex = "&lt;/?{0}[^&lt;]*?&gt;";
public static string RemoveHtmlTag(String input, String[] htmlTags)
{
    String strResult = String.Empty;
    foreach (String htmlTag in htmlTags)
    {
        Regex reg = new Regex(String.Format(STR_RemoveHtmlTagRegex, htmlTag.Trim()), RegexOptions.IgnoreCase);
        strResult = reg.Replace(input, String.Empty);
        input = strResult;
    }
    return strResult;
}
</code></pre>

<p>Now the problem is that it is not removing value of tag, so if there is "Testing</p>" then it returns "Testing", I want to remove whole tag with values as well.</p>
