One of my controls lets the user type a Regular Expression that is used to evaluate the contents of another control. Currently, I am testing to see if the expression is valid using exception handling like so:
testRegEx = New RegEx(userText)
Catch ex As Exception
'Invalid Regular Expression
This works, but it seems wrong. Exceptions are for failure-type scenarios, not common error checking. Is there a way to evaluate a string and determine if it is a valid Regular Expression without creating my own RegEx parser?