I have the following Regex-pattern: "[A-TVWZ]"
. I need it to accept also Empty strings ""
, how can I insert that in my pattern? I need it for my DataGridView, because when the User leaves the cell without writing anythig it gets an error in validating...
Maybe this is too simple; I would check for empty strings without regular expressions.
E.g.:
if ( string.IsNullOrEmpty( myString ) || Regex.IsMatch( "[A-TVWZ]", myString )
{
....
}
See:
String.IsNullOrEmpty
method.Regex.IsMatch
method.If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With