フィールドに重複文字(3つ以上)が含まれていることを確認する必要があります。私はRegularExpressionAttributeで正規表現を使用しますが、動作しません。 例えば、MVC RegularExpressionAttribute。繰り返し文字のテストregexpが機能しない
- パターン:([-ZA-Z])\ 1 {2}
- 入力:
- abcdddf結果:いいえマッチ!代わりに、文字列の
return ((match.Success && (match.Index == 0)) && (match.Length == str.Length));
のみ
return match.Success;
その後、問題が解決されるだろうしている場合
public override bool IsValid(object value) { this.SetupRegex(); string str = Convert.ToString(value, CultureInfo.CurrentCulture); if (string.IsNullOrEmpty(str)) { return true; } Match match = this.Regex.Match(str); return ((match.Success && (match.Index == 0)) && (match.Length == str.Length)); }
:ソースコードの属性に
は、次のコードを持っています。 カスタムRegularExpressionAttributeを実装せずにこの制限を回避する方法はありますか?他の人たちへの正規表現ですか?
ага、точтонадо、спасибо! – user1199305