...

View Full Version : Regular Expressions... confused



ipruthi
08-05-2002, 04:15 AM
Hi,

Scenario: A "telephone number" field in the format: +1718231556 where 1 = country code, 718 = area code, 8231556 = actual phone number... but this is beyond my point.

What's been tried: A strange reg-exp... :rolleyes: here goes...

^(\+)([0-9]){10,15}+$

Umm... I'm using a form-validation script found at www.creativeprogrammers.com and they use objects to do the whole form validation. This description is in their instructions:

regexp=??? -- Check with a regular expression the value should match the regular expression.
example: "regexp=^[A-Za-z]{1,20}$" allow up to 20 alphabetic characters.

which is supposed to be put into:
formValidator.addValidation("telephone_number","regexp=^(\+)([0-9]){10,15}+$","Please enter valid Telephone Number");


Anyone good at Regular Expressions who can help me? Any help is much appreciated:)

I.

jkd
08-05-2002, 05:42 AM
/^\+\d{11}$/

looks for a + sign followed by 11 digits (1 + area code (3) + phone number (7))



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum