Ejemplo n.º 1
0
        private static Regex SetFormatBaseOnOptions(PhoneValidationOptions phoneOptions)
        {
            if (phoneOptions.CellPhonesOnly && phoneOptions.StrictNineDigit)
            {
                return(new Regex(@"^(?:(?:\+?55)?[ .-]*\(?0?[1-9][0-9]\)?)[ .-]?(?:(?:(?:9[ .-]*)[0-9]{4})[ .-]*[0-9]{4})$"));
            }

            if (phoneOptions.CellPhonesOnly && !phoneOptions.StrictNineDigit)
            {
                return(new Regex(@"^(?:(?:\+?55)?[ .-]*\(?0?[1-9][0-9]\)?)[ .-]?(?:(?:(?:9[ .-]*)[0-9]{4}|[8-9][0-9]{3})[ .-]*[0-9]{4})$"));
            }

            if (!phoneOptions.CellPhonesOnly && phoneOptions.StrictNineDigit)
            {
                return(new Regex(@"^(?:(?:\+?55)?[ .-]*\(?0?[1-9][0-9]\)?)[ .-]?(?:(?:9[ .-]*[0-9]{4}|[1-7][0-9]{3})[ .-]*[0-9]{4})$"));
            }

            return(_defaultFormat);
        }
Ejemplo n.º 2
0
 public Phone()
 {
     _validationOptions = new PhoneValidationOptions();
 }
Ejemplo n.º 3
0
 public Phone(PhoneValidationOptions validationOptions)
 {
     _validationOptions = validationOptions;
 }