I use this regular expression for checking
public const string FullNameRegularExpression = @"^[a-zA-Z0-9._-]+$";
How to add "spacebar" in?
If you are looking for one single space it is: (
" "
), a very complete example can be found in this reference.
Or if you want to match any whitespace character (\n
,\r
,\f
,\t
, ), you can use
\s
.
Notice an added \s
public const string FullNameRegularExpression = @"^[a-zA-Z0-9._-\s]+$";
You may push a spacebar on your keyboard or add \s or \s+ or \s* to your regex ;-)