Our customer provides hundreds of regular expressions in an excel file that we need to add in our SQL Server to do pattern matching in database, but many times they send invalid or broken regular expression in their excel file.
We validate the regular expressions in c# by instantiating Regex object with given regular expression, if it is incorrect then error is caught in catch block and we know which expression is invalid.
try
{
var test = new Regex(rule.RegexExpression);
}
catch (Exception ex)
{
Errors.Add("Error in " + rule.Id)
}
Problem: It gets too late in knowing which regular expressions are incorrect until developer validates data given by customer.
Question: Is there a way in which our customer can validate hundreds of regular expression with a click of a button in excel (something like VBA macro button). I tried VBA Regex, I couldn't validate the regular expression itself.
Any help or clue is appreciated.