Re: [PHP] Regex for telephone numbers

2010-12-31 Thread Nathan Rixham
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- as the input format. out of interest, why are you forcing you're users to conform to that input format? you could simply

Re: [PHP] Regex for telephone numbers

2010-12-31 Thread Ethan Rosenberg
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- as the input format. out of interest, why are you forcing you're users to

Re: [PHP] Regex for telephone numbers

2010-12-31 Thread a...@ashleysheridan.co.uk
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

Re: [PHP] Regex for telephone numbers

2010-12-31 Thread Ethan Rosenberg
At 09:27 AM 12/31/2010, a...@ashleysheridan.co.uk wrote: 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

Re: [PHP] Regex for telephone numbers

2010-12-31 Thread Nathan Rixham
Ethan Rosenberg wrote: 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- as the input format. out of interest, why are you

Re: [PHP] Regex for telephone numbers

2010-12-31 Thread Per Jessen
a...@ashleysheridan.co.uk wrote: 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? AFAIK, they too vary from country to country. Swiss mobile numbers are 07[6789] NNN, the latter usually written as

Re: [PHP] Regex for telephone numbers

2010-12-31 Thread Daniel P. Brown
On Fri, Dec 31, 2010 at 11:04, Per Jessen p...@computer.org wrote: AFAIK, they too vary from country to country.  Swiss mobile numbers are 07[6789] NNN, the latter usually written as NNN NN NN, but also often in a way that will help remembering the number. Danish mobile#s are the same as

Re: [PHP] Regex for telephone numbers

2010-12-31 Thread Dmitriy Ugnichenko
I guess, this will work fine ereg('[0-9]{3}-[0-9]{3}-[0-9]{4}', $phone_number); On Thu, Dec 30, 2010 at 2:12 AM, Ethan Rosenberg eth...@earthlink.netwrote: Dear List - Thank you for all your help in the past. Here is another one I would like to have a regex which would validate

Re: [PHP] Regex for telephone numbers

2010-12-31 Thread Daniel Brown
On Fri, Dec 31, 2010 at 12:05, Dmitriy Ugnichenko mitya.ugniche...@gmail.com wrote: I guess, this will work fine ereg('[0-9]{3}-[0-9]{3}-[0-9]{4}',  $phone_number); Not quite. Plus, all ereg* functions have been deprecated for some time now. -- /Daniel P. Brown Network Infrastructure

Re: [PHP] Regex for telephone numbers

2010-12-31 Thread Steve Staples
On Wed, 2010-12-29 at 19:35 -0500, Daniel P. Brown wrote: On Wed, Dec 29, 2010 at 19:12, Ethan Rosenberg eth...@earthlink.net wrote: Dear List - Thank you for all your help in the past. Here is another one I would like to have a regex which would validate that a telephone

Re: [PHP] Regex for telephone numbers

2010-12-31 Thread Jim Lucas
On 12/29/2010 4:35 PM, Daniel P. Brown wrote: On Wed, Dec 29, 2010 at 19:12, Ethan Rosenberg eth...@earthlink.net wrote: Dear List - Thank you for all your help in the past. Here is another one I would like to have a regex which would validate that a telephone number is in the format

Re: [PHP] Regex for telephone numbers

2010-12-31 Thread Daniel P. Brown
On Fri, Dec 31, 2010 at 19:09, Jim Lucas li...@cmsws.com wrote: Actually... Specified here [1] it says that the {1,} is the same as '+'.  I think you should drop the comma.  If you don't this would be valid 844-2345-123456 ^[2-9]{1,}[0-9]{2,}\-[2-9]{1,}[0-9]{2,}\-[0-9]{4,}$ should be

Re: [PHP] Regex for telephone numbers

2010-12-30 Thread Ethan Rosenberg
At 07:27 PM 12/29/2010, Josh Kehn wrote: On Dec 29, 2010, at 7:12 PM, Ethan Rosenberg eth...@earthlink.net wrote: Dear List - Thank you for all your help in the past. Here is another one I would like to have a regex which would validate that a telephone number is in the format

[PHP] Re: [PHP-DB] Re: [PHP] Regex for telephone numbers

2010-12-30 Thread Daniel Brown
On Thu, Dec 30, 2010 at 14:07, Ethan Rosenberg eth...@earthlink.net wrote: Josh - I used use \d{3}-\d{3}-\d{4}. It works beautifully!! Just keep in mind that invalid numbers will also pass that check, such as 000-000- or 123-456-6789. That's why my example was a bit more involved.

Re: [PHP] Regex for telephone numbers

2010-12-30 Thread Tamara Temple
On Dec 29, 2010, at 6:12 PM, Ethan Rosenberg wrote: I would like to have a regex which would validate that a telephone number is in the format xxx-xxx-. http://lmgtfy.com/?q=regex+to+validate+US+phone+numbers -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit:

RE: [PHP] Regex for telephone numbers

2010-12-29 Thread admin
I suggest you try javascript. Richard L. Buskirk -Original Message- From: Ethan Rosenberg [mailto:eth...@earthlink.net] Sent: Wednesday, December 29, 2010 7:12 PM To: php-db-lists.php.net; php-general@lists.php.net Subject: [PHP] Regex for telephone numbers Dear List - Thank you for

Re: [PHP] Regex for telephone numbers

2010-12-29 Thread Simon J Welsh
On 30/12/2010, at 1:12 PM, Ethan Rosenberg wrote: Dear List - Thank you for all your help in the past. Here is another one I would like to have a regex which would validate that a telephone number is in the format xxx-xxx-. Thanks. Ethan MySQL 5.1 PHP 5 Linux

RE: [PHP] Regex for telephone numbers

2010-12-29 Thread admin
Also remove your stupid Email filter. If you need a email filter, you should not be on this list or learn to setup rules one. Richard L. Buskirk -Original Message- From: Ethan Rosenberg [mailto:eth...@earthlink.net] Sent: Wednesday, December 29, 2010 7:12 PM To: php-db-lists.php.net;

Re: [PHP] Regex for telephone numbers

2010-12-29 Thread Josh Kehn
On Dec 29, 2010, at 7:12 PM, Ethan Rosenberg eth...@earthlink.net wrote: Dear List - Thank you for all your help in the past. Here is another one I would like to have a regex which would validate that a telephone number is in the format xxx-xxx-. Thanks. Ethan

[PHP] Re: [PHP-DB] Re: [PHP] Regex for telephone numbers

2010-12-29 Thread Karl DeSaulniers
Hi Ethan, Could you do a string compare and check at certain characters for a dash? IE: check the second character to see if it is a dash for 1-800... if that is not a dash, check the fourth character for a dash, 469-9... then the other places where dashes would be based on those two

[PHP] Re: [PHP-DB] Re: [PHP] Regex for telephone numbers

2010-12-29 Thread Karl DeSaulniers
You could also help them out a little with something like.. $phone = str_replace((, , $phone); $phone = str_replace(), -, $phone); HTH, Karl On Dec 29, 2010, at 6:27 PM, Josh Kehn wrote: On Dec 29, 2010, at 7:12 PM, Ethan Rosenberg eth...@earthlink.net wrote: Dear List - Thank you

Re: [PHP] Re: [PHP-DB] Re: [PHP] Regex for telephone numbers

2010-12-29 Thread Alexis
Why not have three separate fields for each part, as that way you don't need to bother about how the user separates them, as trust me, if they can break it, they will. I have found it is best to always limit the amount of free entry you permit a user, as that will drastically cut back in data

Re: [PHP] Regex for telephone numbers

2010-12-29 Thread Daniel P. Brown
On Wed, Dec 29, 2010 at 19:12, Ethan Rosenberg eth...@earthlink.net wrote: Dear List - Thank you for all your help in the past. Here is another one I would like to have a regex  which would validate that a telephone number is in the format xxx-xxx-. Congrats. People in Hell