I need to know if it's safe to create a static Regex object like this:
public static Regex s_Regex_ExtractEmails = new Regex(@"\b[A-Z0-9._%+-]+@(?:[A-Z0-9-]+\.)+[A-Z]{2,4}\b");
And call it statically from ASP.NET threads like this:
s_Regex_ExtractEmails.Matches("my email is mail@email.com")
Would this cause any problems?
I am doing this basically as an optimization so that the Regex object can be precompiled and reused.