@@ -38,29 +38,34 @@ public RegularExpressionValidator(string expression) : base(nameof(Messages.rege
3838 }
3939
4040 public RegularExpressionValidator ( Regex regex ) : base ( nameof ( Messages . regex_error ) , typeof ( Messages ) ) {
41+ ErrorCodeSource = new StaticStringSource ( ValidationErrors . RegularExpression ) ;
4142 this . expression = regex . ToString ( ) ;
4243 this . regexFunc = x => regex ;
4344 }
4445
4546 public RegularExpressionValidator ( string expression , RegexOptions options ) : base ( nameof ( Messages . regex_error ) , typeof ( Messages ) ) {
47+ ErrorCodeSource = new StaticStringSource ( ValidationErrors . RegularExpression ) ;
4648 this . expression = expression ;
4749 var regex = new Regex ( expression , options ) ;
4850 this . regexFunc = x => regex ;
4951 }
5052
5153 public RegularExpressionValidator ( Func < object , string > expressionFunc )
5254 : base ( nameof ( Messages . regex_error ) , typeof ( Messages ) ) {
55+ ErrorCodeSource = new StaticStringSource ( ValidationErrors . RegularExpression ) ;
5356 this . regexFunc = x => new Regex ( expressionFunc ( x ) ) ;
5457 }
5558
5659 public RegularExpressionValidator ( Func < object , Regex > regexFunc )
5760 : base ( nameof ( Messages . regex_error ) , typeof ( Messages ) ) {
61+ ErrorCodeSource = new StaticStringSource ( ValidationErrors . RegularExpression ) ;
5862 this . regexFunc = regexFunc ;
5963 }
6064
6165 public RegularExpressionValidator ( Func < object , string > expression , RegexOptions options )
6266 : base ( nameof ( Messages . regex_error ) , typeof ( Messages ) ) {
6367
68+ ErrorCodeSource = new StaticStringSource ( ValidationErrors . RegularExpression ) ;
6469 this . regexFunc = x => new Regex ( expression ( x ) , options ) ;
6570 }
6671
0 commit comments