Try your search with a different keyword or use * as a wildcard.
using FluentValidation;
using FluentValidation.Validators;
using Nop.Core;
namespace Nop.Web.Framework.Validators;
///
/// Email address validator
///
public partial class EmailPropertyValidator : PropertyValidator, IRegularExpressionValidator, IPropertyValidator
{
#region Utilities
///
/// Returns the default error message template for this validator, when not overridden.
///
/// The currently configured error code for the validator.
protected override string GetDefaultMessageTemplate(string errorCode)
{
return Localized(errorCode, Name);
}
#endregion
#region Methods
///
/// Validates a specific property value.
///
/// The validation context. The parent object can be obtained from here.
/// The current property value to validate
/// True if valid, otherwise false.
public override bool IsValid(ValidationContext context, string value)
{
return value == null || CommonHelper.GetEmailRegex().IsMatch(value);
}
#endregion
#region Properties
///
/// The name of the validator. This is usually the type name without any generic parameters. This is used as the default Error Code for the validator.
///
public override string Name => "EmailPropertyValidator";
///
/// Gets regular expression for client side (pattern source: https://emailregex.com/)
///
public string Expression => @"^(([^<>()\[\]\\.,;:\s@""]+(\.[^<>()\[\]\\.,;:\s@""]+)*)|("".+""))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$";
#endregion
}