My application includes creating POCO classes at runtime using the CodeDOM. I am looking for a way to allow my end user to specify a limitation on the value of some properties he creates (e.g. if he adds a property Email than he would probably like to validate the content to an email address. It is obvious that the end user might have more custom restrictions).
My intention is to offer a PropertyValidation
field where the end user can provide a regular expression which serve as a validator for the content of created instances of that property.
Is there any way I can make sure the string provided in the PropertyValidation
field is an actual Regex
before allowing it?