I\'m new to TDD, and I find RegExp quite a particular case. Is there any special way to unit test them, or may I just treat them as regular functions?
Presumably your regular expressions are contained within a method of a class. For example:
public bool ValidateEmailAddress( string emailAddr )
{
// Validate the email address using regular expression.
return RegExProvider.Match( this.ValidEmailRegEx, emailAddr );
}
You can now write tests for this method. I guess the point is is that the regex is an implementation detail - your test needs to test the interface, which in this case is just the validate email method.