I needed a super simple parser to get HTML attributes and their values. I didnt want to load a big library or anything so I made this.I realize I am making assumptions here, mainly:Attribute values will be surrounded with either single or doublequotes.The input string will end with > or />.Besides those assumptions are there any other glaring issues here?Dictionary<string, string> HTMLAttributes(string tag){    Dictionary<string, string> attr = new Dictionary<string, string>();    MatchCollection matches =         Regex.Matches(tag, @([^\t\n\f \/>'=]+)(?:=)('.*?'|.*?)(?:\s|\/>|\>));    foreach (Match match in matches)    {        attr.Add(match.Groups[1].Value,            match.Groups[2].Value.Substring(1, match.Groups[2].Value.Length - 2)            );    }    return attr;}Running:HTMLAttributes(<body class=\ something \ hello='world' />);Returns:{    class:  something ,    hello: world}Sample:http://ideone.com/ZBaBhB
Is this a safe way to parse out HTML tag attributes?
c#;html;parsing;regex
Whitespace around = is allowed, your regex won't handle that.Characters in HTML can be encoded, some characters (like &) have to be encoded. For example name=AT&amp;T should return that the value of name is AT&T.