Skip to content

Commit

Permalink
Fix RegexValidator allowing partial matches
Browse files Browse the repository at this point in the history
Now RegexValidator must require a full match on the target string to return a successfull match
  • Loading branch information
ModernMAK committed Sep 25, 2024
1 parent 81f0a46 commit 0342440
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/Pure.Blazor.Components/Forms/Validators/RegexValidator.cs
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ public override ValidationResult ExecuteValidate(string? input)
}

var match = _rx.Match(input);

return new ValidationResult(match.Success, match.Success == false ? $"{input} does not match the regular expression" : null);
var success = match.Success && match.Value == input;
return new ValidationResult(success, success == false ? $"{input} does not match the regular expression" : null);
}
}
}

0 comments on commit 0342440

Please sign in to comment.