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?
>
> 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 character range. Given that there are only 2 characters
> in that class I don't think it should matter, but it might.
>
> Spike
>
> --------------------------------------------
> Stephen Milligan
> Code poet for hire
> http://www.spike.org.uk
>
> 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 8:51 AM
>  >To: CF-Talk
>  >Subject: Stupid telephone regex question
>  >
>  >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
>  >definitely me doing something stupid here.
>  >
>  >
>  >ThisRegex="[\(.]?[2-9]\d\d[\).]?[ -]?[2-9]\d\d[-.]\d{4}";
>  >
>  >if (not REFind(ThisRegex, form.myphonefield) {
>  >...
>  >
>  >What is my coffee-starved Monday morning brainlet missing here?
>  >
>  >--
>  >--Matt Robertson--
>  >MSB Designs, Inc.
>  >mysecretbase.com
>  >
>  >
>
[Todays Threads] [This Message] [Subscription] [Fast Unsubscribe] [User Settings] [Donations and Support]

Reply via email to