using FluentValidation; namespace ExpenseTracker.Application.Authentication.Commands.RegisterWithEmail; public class RegisterWithEmailCommandValidator : AbstractValidator { public RegisterWithEmailCommandValidator() { // https://regexr.com/2ri2c RuleFor(v => v.Email) .NotEmpty() .WithMessage("Email address is required.") .Matches(@"\b[\w\.-]+@[\w\.-]+\.\w{2,4}\b") .WithMessage("Email address is invalid."); } }