I have a specialized property in episerver named Location with a below given structure:
public virtual string Name{ get; set; }
public virtual string City { get; set; }
[RegularExpression("^(\\+\\s?)?((?<!\\+.*)\\(\\+?\\d+([\\s\\-\\.]?\\d+)?\\)|\\d+)([\\s\\-\\.]?(\\(\\d+([\\s\\-\\.]?\\d+)?\\)|\\d+))*(\\s?(x|ext\\.?)\\s?\\d+)?$", ErrorMessage = "Invalid Phone Number")]
public virtual string PhoneNumber { get; set; }
The phone property is not a required one & the given regex handles it fine. With the regex, validation kicks in the next instant.
Issue Now when i create a custom attribute with the same regex in it ,the validation only kicks in when the page which includes this specialized location property is published.
Could some one shed some light on why client validation kicks in with regex & not with custom attribute?
Regards.


