when creating a user from aws via the console. they used below regex validation pattern as per below screenshot.
regex pattern
"^+[1-9][0-9]{0,24}$"
but when i try this mobile number with python it was matched. but in the console or api it gives an error called invalid mobile number
sample mobile number +80570497
python script
>>> re.match(r"^+[1-9][0-9]{0,24}$", "+80570497")
<re.Match object; span=(0, 9), match='+80570497'>
>>>
2
Answers
Cognito said:
You are missing the country code in your phone number you have to follow the E.164 format. For example, if this is a Sri Lanka phone number, it should be written as +9480570497, where
94
is the country calling code for Sri Lanka.Cognito seems to be doing some more validation besides the regex from the screenshot. For example numbers starting with +80,+21,+259 and more.
Looks like it does not allow any country codes that’s are currently unassigned from this list https://en.wikipedia.org/wiki/List_of_country_calling_codes