So I've searched and tried various validations in different posts from here to stackexchange to reddit.
I am looking for a validation where in the Phone field, the number can be either domestic or international but must start with a + symbol.
US numbers need to have the 1 country code, so should look like +1xxxxxxxxxx.
International numbers need to start with a + and then the country code so like +44xxxxxxxxxx.
Always with a + and NO dashes in btwn.
Has anyone successfully done this please? TIA!!!
Hi Barb,
You can handle this with a Validation Rule using REGEX(). For example, if the field is Phone:
AND(
NOT(ISBLANK(Phone)),
NOT(REGEX(Phone, "^\\+[0-9]+$")),
OR(
LEFT(Phone, 2) <> "+1",
LEN(Phone) <> 12
)
)
However, because you want US numbers to be exactly +1 + 10 digits, while international numbers can have different country-code and phone-number lengths, I’d recommend separating the US and international checks:
AND(
NOT(ISBLANK(Phone)),
NOT(
OR(
REGEX(Phone, "^\\+1[0-9]{10}$"),
REGEX(Phone, "^\\+[2-9][0-9]{6,14}$")
)
)
)
This requires:
- + at the beginning
- digits only after +
- US: exactly +1 followed by 10 digits
- International: + followed by 8–15 digits, with no dashes/spaces
You can adjust the international length if your organization's phone-number requirements are more specific.