Is there any simple way in C# to test if a regular expression is a regular expression? In other words, I would like to check if a user-provided regex pattern is malformed or not. This is purely a syntax test and not what the regex is supposed to achieve/test. Thanks
Share
You may try passing it to the Regex constructor and catch potential ArgumentException which is thrown if the argument is a malformed regular expression.