IsPhoneNumber Function

The IsPhoneNumber function returns a value of true or false. This uses the same phone number validation as MobileConnect but note that it does not use the E.164 number format with the plus (+) symbol.

Example:

A good use case might be to check the phone number a user enters into a CloudPage form.

					

%%[
set @phone = ‘13105555555’

IF IsPhoneNumber(@phone) == ‘true’ THEN
set @msg = ‘Phone Number is Valid’
ELSE
set @msg = ‘Phone Number is Invalid’
ENDIF

]%%
%%=v(@msg)=%%

Output:

Phone Number is Valid

Explanation:

This works for US numbers with 10-digits including area code or 11-digits including the prefix of 1.

Leave a Reply

Your email address will not be published. Required fields are marked *