why ignore four specified string

Topics: Developer Forum, Project Management Forum, User Forum
Jul 4, 2013 at 6:28 AM
Edited Jul 4, 2013 at 7:44 AM
see code below, what ignore four string: &, >, <,"??
public static string HtmlEncode(string html)
    {
        if (html == null)
        {
            throw new ArgumentNullException("html");
        }
        // replace & by &amp; but only once!
        Regex rx = new Regex("&(?!(amp;)|(lt;)|(gt;)|(quot;))", RegexOptions.IgnoreCase);
        return rx.Replace(html, "&amp;").Replace("<", "&lt;").Replace(">", "&gt;").Replace("\"", "&quot;");
    }
if the html input are &#1288; and &#1288, they will have same output, which are not my expected answer
can anyone help me?