RE: Stupid telephone regex question

2004-08-03 Thread Pascal Peters
think the following regexp would do it: ^([2-9]\d\d([.-])[2-9]\d\d\2\d{4}|\([2-9]\d\d\)[ ]?[2-9]\d\d-\d{4})$ Pascal -Original Message- From: Jochem van Dieten [mailto:[EMAIL PROTECTED] Sent: 02 August 2004 20:18 To: CF-Talk Subject: Re: Stupid telephone regex question Matt Robertson

Re: Stupid telephone regex question

2004-08-03 Thread Peter Farrell
hi, You could stip all the punct and spaces with REReplace and then check the lenof 10 and isNumeric(). Then you have numeric string that you can format any way you wish. Just another approach if you want some more flexiblity in formatting changes in the future.Also, then you can store the

RE: Stupid telephone regex question

2004-08-03 Thread Lofback, Chris
Why restrict yourself?Allow ther user to mix-and-match phone formats and then reformat as needed: CFSET Phone = 123.456.7890 CFIF REFind(^([0-9]{3}[-\. ]?|\([0-9]{3}\) ?)[0-9]{3}[-\. ]?[0-9]{4}$,Trim(Phone)) CFSET Temp = REReplace(Phone,[^0-9],,ALL) CFSET Formatted = ( Left(Temp,3) )

RE: Stupid telephone regex question

2004-08-02 Thread Calder, Erick
REFind() returns a position value, not a boolean, you should check with EQ 0 instead -Original Message- From: Matt Robertson [mailto:[EMAIL PROTECTED] Sent: Monday, August 02, 2004 9:51 AM To: CF-Talk Subject: Stupid telephone regex question I'm trying to use this code and it keeps

RE: Stupid telephone regex question

2004-08-02 Thread Spike
That's a pretty specific regex for a phone number. Can you post an example of a number that should pass, but is failing? The only thing I can see that might be a bit odd is the [-.] class. Normally you have to put the - at the end of the class so the regex engine doesn't see it as part of a

Re: Stupid telephone regex question

2004-08-02 Thread Ben Doom
The hyphen represents the hypen anywhere it could not represent a span of characters.So [0-9-a-z] works, putting it at the beginning works, etc. --Ben Spike wrote: That's a pretty specific regex for a phone number. Can you post an example of a number that should pass, but is failing?

Re: Stupid telephone regex question

2004-08-02 Thread Ben Doom
Is this in CFMX?This won't work in CF5 or earlier.They don't recognize \d as digits. --Ben Matt Robertson wrote: I'm trying to use this code and it keeps throwing out the string whether its valid or not.I know I'm doing something wrong but am a dilettante at best when it comes to regexes.I

Re: Stupid telephone regex question

2004-08-02 Thread Jochem van Dieten
Matt Robertson wrote: I'm trying to use this code and it keeps throwing out the string whether its valid or not.I know I'm doing something wrong but am a dilettante at best when it comes to regexes.I also tried Ben Forta's phone regex out of his book with similarly bad results, so its

Re: Stupid telephone regex question

2004-08-02 Thread Barney Boisvert
I don't know if it'll meet your needs, but I usually validate phone numbers by simply counting the number of digits.For more advanced stuff, just split the number at any non-digit character(s) and that'll yield your parts (country, exchange, etc). cheers, barneyb On Mon, 02 Aug 2004 19:48:29

Re: Stupid telephone regex question

2004-08-02 Thread Matt Robertson
Sorry, I should have specified U.S. phone number. Realized it right after my post. The regex *should* accept numbers formatted as such: 000-000- (000) 000- (000)000- 000.000. where the zeroes represent a digit range from 2-9 in the first position, of area code and prefix, and

Re: Stupid telephone regex question

2004-08-02 Thread Barney Boisvert
How about this: ^[^0-9]*[2-9][0-9]{2}[^0-9]*[0-9]{3}[^0-9]*[0-9]{4}[^0-9]*$ cheers, barneyb On Mon, 2 Aug 2004 11:03:57 -0700, Matt Robertson [EMAIL PROTECTED] wrote: Sorry, I should have specified U.S. phone number. Realized it right after my post. The regex *should* accept numbers

RE: Stupid telephone regex question

2004-08-02 Thread Spike
Do you cfeclipse? http://cfeclipse.tigris.org -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Matt Robertson Sent: Monday, August 02, 2004 10:04 AM To: CF-Talk Subject: Re: Stupid telephone regex question Sorry, I should have specified U.S. phone

RE: Stupid telephone regex question

2004-08-02 Thread Burns, John D
tougher with international, but works quite well for US numbers. John -Original Message- From: Matt Robertson [mailto:[EMAIL PROTECTED] Sent: Monday, August 02, 2004 2:04 PM To: CF-Talk Subject: Re: Stupid telephone regex question Sorry, I should have specified U.S. phone number. Realized

Re: Stupid telephone regex question

2004-08-02 Thread Jochem van Dieten
Matt Robertson wrote: The regex *should* accept numbers formatted as such: 000-000- (000) 000- (000)000- 000.000. where the zeroes represent a digit range from 2-9 in the first position, of area code and prefix, and any digit in any other position. How about:

Re: Stupid telephone regex question

2004-08-02 Thread Matt Robertson
Jochem wrote: Don't use a style where you make the check for a ) my bad.Copied the thing by hand out of the book and screwed it up. Also thx very much for the regex.I'll plug it in and test it. Knowing you I'm sure it works :-) John, I'm working with the canned form field validator built into