当我这样做的时候:
var m = Regex.Match("aabbccddeeff", "[0-9a-fA-F]{6}");
结果我只得到AABBCC。实际上(使用.matches)有两个匹配项:aabbcc和ddeeff。
为什么?这会导致dataAnnotations.RegularExpressionAttribute出现问题,因为它需要包含整个输入值的单个匹配。
我如何正确地写这个以获得一个匹配?
Regex.Match Regex.Matches
Regex.Match
Regex.Matches
Regex.IsMatch
^[0-9a-fA-F]{6}$
[0-9a-fA-F]+
[0-9a-fA-F]{12}
^ $
^
$
([0-9a-fA-F])* * +
([0-9a-fA-F])*
*
+