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 formatted as such:
>
> 000-000-0000
> (000) 000-0000
> (000)000-0000
> 000.000.0000
>
> 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.
>
> I picked up this regex from a web site somewhere.  Can't find it at the moment.
>
> The regex from Ben's book is
>
> \(?[2-9]\d\d\)?[ -]?[2-9]\d\d-\d{4}
>
> and accepts a more limited range.  I could live with that, actually.
> Not married to the accept-multiple-formats idea.
>
> Yes this is CF 6.1.  Don't have to make this one backward-compatible.
>
> ReFind is being used as part of a generic field validation processor.
> I can plug in a custom regex but the method of applying it has to be
> via ReFind.  If refind returns zero I know the test failed.
>
> The only time refind hasn't worked for me as shown is when I screw up
> the regex.  Is there a better way to do this?
>
> --
[Todays Threads] [This Message] [Subscription] [Fast Unsubscribe] [User Settings] [Donations and Support]

Reply via email to