private void InitializeRegex(string pattern, bool compiled)
{
try {
if(compiled) {
regex = new Regex(pattern, RegexOptions.Compiled);
}
else {
regex = new Regex(pattern);
}
}
catch(Exception e) {
Debug.ReportError("Failed to initialize Regex. Error: {0}", e.Message);
}
}