I have a Regex object created using the new Regex(string pattern) constructor, is there any way later to see which template created the regular expression object?
I cannot access the element of the string "pattern" in Regex or RegexOptions .
Context: the reason I ask, I create several regular expression objects at an early stage during initialization (templates are stored in the configuration file), then they are passed to another class, which will be used often. However, I also need to compare the template string with those stored in the SQL database at runtime.
I would prefer not to pass the template string in addition to the regex object. I also feel that creating an object once at startup is not a bad idea, since the regex will be reused hundreds of times?
Feel free to offer alternative tips.
source share