This class is throwing an exception. It doesn't show me the exact line number, but it sounds like it's occurring in the static constructor:
static class _selectors
{
public static string[] order = new[] { "ID", "NAME", "TAG" };
public static Dictionary<string, Regex> match = new Dictionary<string, Regex> {
{ "ID", new Regex(@"#((?:[\w\u00c0-\uFFFF-]|\\.)+)") },
{ "CLASS", new Regex(@"\.((?:[\w\u00c0-\uFFFF-]|\\.)+)") },
{ "NAME", new Regex(@"\[name=['""]*((?:[\w\u00c0-\uFFFF-]|\\.)+)['""]*\]") },
{ "ATTR", new Regex(@"\[\s*((?:[\w\u00c0-\uFFFF-]|\\.)+)\s*(?:(\S?=)\s*(['""]*)(.*?)\3|)\s*\]") },
{ "TAG", new Regex(@"^((?:[\w\u00c0-\uFFFF\*-]|\\.)+)") },
{ "CHILD", new Regex(@":(only|nth|last|first)-child(?:\((even|odd|[\dn+-]*)\))?") },
{ "POS", new Regex(@":(nth|eq|gt|lt|first|last|even|odd)(?:\((\d*)\))?(?=[^-]|$)") },
{ "PSEUDO", new Regex(@":((?:[\w\u00c0-\uFFFF-]|\\.)+)(?:\((['""]?)((?:\([^\)]+\)|[^\(\)]*)+)\2\))?") }
};
public static Dictionary<string, Action<HashSet<XmlNode>, string>> relative = new Dictionary<string, Action<HashSet<XmlNode>, string>> {
{ "+", (checkSet, part) => {
}}
};
public static Dictionary<string, Regex> leftMatch = new Dictionary<string, Regex>();
public static Regex origPOS = match["POS"];
static _selectors()
{
foreach (var type in match.Keys)
{
_selectors.match[type] = new Regex(match[type].ToString() + @"(?![^\[]*\])(?![^\(]*\))");
_selectors.leftMatch[type] = new Regex(@"(^(?:.|\r|\n)*?)" + Regex.Replace(match[type].ToString(), @"\\(\d+)", (m) =>
@"\" + (m.Index + 1)));
}
}
}
Why can't I change those values in the c'tor?