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?
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
您可以将空格与\\s
匹配:
^[A-Za-z0-9()\s]+$
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.