2015-03-25 75 views

回答

1
' 

表示它用作兩個單詞之間的分隔符,就像您在上面的代碼中一樣。

或者你可以說分離的代碼。

和'\用於將文本設置爲字符串。

[RegularExpression(@"^[a-zA-Z''-'\s]{1,40}$")] 

上面的代碼的含義:

[a-zA-Z''-'\s]{1,40} match a single character present in the list below 

Quantifier: {1,40} Between 1 and 40 times, as many times as possible, giving back as needed [greedy] 
a-z a single character in the range between a and z (case sensitive) 
A-Z a single character in the range between A and Z (case sensitive) 
' the literal character ' 
'-' a single character in the range between ' and ' 
\s match any white space character [\r\n\t\f ] 
+0

你的 '量詞' 註釋沒有太大的意義。它是匹配範圍的最小最大長度。 – Phill 2015-03-25 08:18:21