Sorry for top-post, on phone. What about mobile phone numbers (cell phones you call them in the US) do they conform to the same format? I know there have been times myself when I've been without a landline number leaving me with only my mobile as a means of contact. Thanks, Ash http://www.ashleysheridan.co.uk ----- Reply message ----- From: "Ethan Rosenberg" <ethros@xxxxxxxxxxxxx> Date: Fri, Dec 31, 2010 14:03 Subject: [PHP] Regex for telephone numbers To: "Nathan Rixham" <nrixham@xxxxxxxxx> Cc: "php-general@xxxxxxxxxxxxx" <php-general@xxxxxxxxxxxxx> At 07:11 AM 12/31/2010, Nathan Rixham wrote: >Ethan Rosenberg wrote: >>FYI [to all the list] -- I thank all for their input. I only >>needed US phones, and I am forcing the user of the form to conform >>to xxx-xxx-xxxx as the input format. > >out of interest, why are you forcing you're users to conform to that >input format? you could simply strip all non-numeric chars then >format how you like to save, thus giving users a looser, more >friendly, experience. +++++++++ Nathan - This expression will be used to search a database which will contain patient data resulting from medical research. At the initial visit a medical record number will be assigned to the patient. Other information will be collected at that point; eg, the telephone number. At subsequent visits, the patient will be referenced by his/hers medical record number. If the patient either forgot their clinic card, or cannot remember their medical record number, a search will be performed. One of the many parameters that can be used in the search is the phone number. It is easier if all the data has a fixed format. The form for the initial visit will use a regex that will validate the phone number. As the research will be performed in the US, only US numbers have to be validated. Hope this helps. Ethan -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php