Re: [PHP] Regex for telephone numbers

2010-12-31 Thread Daniel P. Brown
On Fri, Dec 31, 2010 at 19:09, Jim Lucas 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 > > ^[2-

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 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

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 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 > >

Re: [PHP] Regex for telephone numbers

2010-12-31 Thread Daniel Brown
On Fri, Dec 31, 2010 at 12:05, Dmitriy Ugnichenko 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. -- Network Infrastructure Manager Documentation, Webmaster Teams htt

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 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 Daniel P. Brown
On Fri, Dec 31, 2010 at 11:04, Per Jessen 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 land line num

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 a

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 forcin

Re: [PHP] Regex for telephone numbers

2010-12-31 Thread Ethan Rosenberg
only my mobile as a means of contact. Thanks, Ash <http://www.ashleysheridan.co.uk>http://www.ashleysheridan.co.uk - Reply message - From: "Ethan Rosenberg" Date: Fri, Dec 31, 2010 14:03 Subject: [PHP] Regex for telephone numbers To: "Nathan Rixham" Cc: "ph

Re: [PHP] Regex for telephone numbers

2010-12-31 Thread a...@ashleysheridan.co.uk
http://www.ashleysheridan.co.uk - Reply message - From: "Ethan Rosenberg" Date: Fri, Dec 31, 2010 14:03 Subject: [PHP] Regex for telephone numbers To: "Nathan Rixham" Cc: "php-general@lists.php.net" At 07:11 AM 12/31/2010, Nathan Rixham wrote: >Ethan Rosenbe

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 confor

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 stri

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: ht

[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 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. -- Network I

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 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-. >

Re: [PHP] Regex for telephone numbers

2010-12-29 Thread Daniel P. Brown
On Wed, Dec 29, 2010 at 19:12, 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-. Congrats. People in Hell would like ice

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 en

[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 wrote: Dear List - Thank you for all your

[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 charact

Re: [PHP] Regex for telephone numbers

2010-12-29 Thread Josh Kehn
On Dec 29, 2010, at 7: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

RE: [PHP] Regex for telephone numbers

2010-12-29 Thread admin
; php-general@lists.php.net Subject: [PHP] Regex for telephone numbers 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 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

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

[PHP] Regex for telephone numbers

2010-12-29 Thread Ethan Rosenberg
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 [Debian (sid)] -- PHP General Mailing List (http://www.php.net/)