How to apply regex formatting to phone numbers coming through API call.
I am storing numbers in our database that we will be sending sms messages to via Twillio.Â
However, some of the numbers we receive come through in the following formats:
+1(123)-234-2311
+1 123 121 12121
etc...
And this breaks the API send message function.
So I would like to apply the standard Twillio regex ^ +[1-9] d{1,14}$ to inbound numbers and then store the numbers in the DB so that numbers are stored correctly such as 112312312121.
I have not been able to find any documentation on this.Â
Would love some help please on how to achieve this? Thanks.
Other
3 replies