Reputation: 11971
I have a regular expression:
^[A-Za-z0-9()]+$
this doesn't allow spaces, commas, fullstops, forward slashes or backslashes
I am a massive amateur when it comes to this. Can anyone just tell me how to get it to allow spaces?
Upvotes: 1
Views: 226
Reputation: 301507
Just add a space?
^[A-Za-z0-9() ]+$
Update for comments:
Sample code:
Regex re = new Regex(@"^[A-Za-z0-9() \\/.-]+$");
var result = re.Match(@"a. z-1\2/");
Console.WriteLine(result.Success);
and gives true
Upvotes: 6