Has someone a ready-to-use regex to validate if a phone number in a field has canonical address format?
It would also be useful if the module would allow to rewrite other formats to canonical address format on validation and saves the reformatted phone number in canonical address format in the database.
Comments
Comment #1
hass commentedMaybe use this regex
^(?:(\+\d{1,2})\s(?:\(\d{1,}\))\s(?:\d+[-.\s]?+)\d{1,})$It will allow only:
Comment #2
g089h515r806 commentedI'd like to add a phone validator and copy all the regrex expression from phone module.
It is a little shameless.
Comment #3
hass commentedI have not used phone module myself as it seems not well maintained, but I could be wrong.
Comment #4
sportel commented@ g089h515r806
I would like that. All those seperate modules for validating things (phone-number, zip/postal-code, etc...) are unnecessary because we've got the Field Validatation module.
But proper phone-number-validation is would be dependant on the selected value of another field: Country.
Comment #5
g089h515r806 commentedComment #5.0
g089h515r806 commenteda