Phone Number Validation

Jim Ault JimAultWins at yahoo.com
Wed Feb 15 14:01:14 EST 2006


On 2/15/06 9:33 AM, "Jeff Honken" <jhonken at x12.info> wrote:
> I'm trying to validate a date.  I've been playing with the below code
> but I can't get it to verify a correct phone number.  Can anyone steer
> me in the correct direction on how to verify a phone number in a field
> for the correct format?  Jeff

>From the docs
matchText function 

Platform support:  
Introduced in version 1.0 (Changed in version 2.0)

Returns true if a regular expression is found in the specified string, false
otherwise.

matchText(string,regularExpression[,foundTextVarsList])

matchText("Goodbye","bye") -- returns true
matchText("Goodbye","^Good") -- also returns true
matchText(phoneNumber,"([0-9]+)-([0-9]+-[0-9]+)",areaCode,phone)

HTH

Jim Ault
Las Vegas

On 2/15/06 9:33 AM, "Jeff Honken" <jhonken at x12.info> wrote:

> I'm trying to validate a date.  I've been playing with the below code
> but I can't get it to verify a correct phone number.  Can anyone steer
> me in the correct direction on how to verify a phone number in a field
> for the correct format?  Jeff
> 
> --> Function
> function CheckPhone pPhoneToCheck
>   if pPhoneToCheck is
> matchText(pPhoneToCheck,"([0-9][0-9][0-9])-([0-9][0-9][0-9])-([0-9][0-9]
> [0-9][0-9])")
>     then
>     return pPhoneToCheck
>   else
>     return "Bad Phone"
>   end if
> end CheckPhone
> -->End of Function
> 
> 
> --> Code in Filed
> on closeField
> 
> put CheckPhone(me) into Ewr
>    
>   if Ewr is "Bad Phone" then
>     answer "The Telephone Number you entered must be in the format of
> 000-000-0000"
>     put "" into me
>     focus on me
>     break
>     
>   ELSE
>      
>     Answer "OK Good Number"
>      
>   END IF 
> end closeField
> 
> 
> _______________________________________________
> use-revolution mailing list
> use-revolution at lists.runrev.com
> Please visit this url to subscribe, unsubscribe and manage your subscription
> preferences:
> http://lists.runrev.com/mailman/listinfo/use-revolution





More information about the use-livecode mailing list