
August 27th, 2005, 12:13 PM
|
 |
Newton's Apple Wizard
|
|
Join Date: Nov 2003
Location: Los Angeles
|
|
|
U.S. Phone Number check (modifiable for international)- ASP
phone number must match (xxx)xxx-xxxx or xxx-xxx-xxxx
asp Code:
Original
- asp Code |
|
|
|
<% function chkPhone(phone) dim patern1,patern2 phone = trim(phone) set rgObj = new regexp rgObj.global = true rgObj.ignoreCase = true '(xxx)xxx-xxxx rgObj.pattern = "\(\d{3}\)\d{3}-\d{4}$" patern1 = rgObj.test(phone) 'xxx-xxx-xxxx rgObj.pattern = "\d{3}-\d{3}-\d{4}$" patern2 = rgObj.test(phone) if len(phone) <> 12 then patern2 = false set rgObj = nothing if patern1 or patern2 then chkPhone = true else chkPhone = false end if end function %>
__________________
If you found a post of mine helpful, please click on the on my post to add to my reputation.
|