The following code throws
The type initializer for ‘ConsoleApplication1.Program’ threw an exception.
on the line
public static Regexp[] keepers = { ... };
Why is this wrong and how can I fix it?
namespace ConsoleApplication1
{
class Program
{
public static String output = "";
public static Regex[] keepers = {
new Regex(@"using(?<everythingElse> [a-zA-Z.]+;)"),
new Regex(@"namespace(?<everythingElse> [a-zA-Z._]+)"),
new Regex(@"class(?<everythingElse> [a-zA-Z._]+)"),
new Regex(@"(public|private)? ?(static)? ?(?<type> String|void|int|Double)(" + Regex.Escape("[") + "?" + Regex.Escape("]") + "?" + "(?<functionName> [a-z_]+)(?<params> [^\r\n]+)")
};
[STAThread]
static void Main(string[] args)
{}}}
In the 4. regex
opens a ( at the end. This is not being closed!