Empty string in Regex C#
c#, regex
Solution
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.
Problem
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...