Gossamer Forum
Home : Products : Gossamer Links : Version 1.x :

user regexps

Quote Reply
user regexps
ok.. i wanted to come up with a few REGEXPs to use for the user database.. but i am unaware of "international" formats..

first off.. the two ones i'm trying to figure out are Zipcode and Phone number..

in the US.. zipcode can be...

00000 or 00000-0000

which in REGEXP can be.. ^\d{5}-?\d{0,4}$

are there any other formats?

also.. phone numbers.. i'm not quite sure about country codes and stuff.. cause i'm just a kid.. but i really need help here Smile

in the US.. phones numbers can look like many things.. the more common one is.

000-000-0000 but if you wanted to include the country code.. 1-000-000-0000

i'm guessing that country codes are more than just one number in some countries..

what other formats of telephones are there?

in these cases.. the regexp '^\d{1,3}-\d{3}-\d{3}-\d{4}$'

would work..

thanks for your help!


------------------
Jerry Su
Links SQL Licensed
------------------
Quote Reply
Re: user regexps In reply to
In Canada, postal codes take the form:

[a-z][0-9][a-z] [0-9][a-z][0-9]

It is of course, case-insensitive. For example, my postal code is V6G 1S9


Dan Smile
Quote Reply
Re: user regexps In reply to
hmm.. in that case.. i'll just make the zip code a 10 max any character text field Smile

i don't plan on having anything requiring an address until i get some shopping cart integrations.. and still.. those will only be like commission based sales of downloadable software.. so i won't even need to ship anything or bill them..

Smile

------------------
Jerry Su
Links SQL Licensed
------------------
Quote Reply
Re: user regexps In reply to
hmm.. maybe i should just leave them all alone.. so that it can be in any format.. i have another questiont though.. does every country have Address, City, State, Zip??

do some have more?

thanks!

(post 3000.. i got 2000 too Smile)

------------------
Jerry Su
Links SQL Licensed
------------------
Quote Reply
Re: user regexps In reply to
Hi widgetz,

All I can tell you is the most anoying problem of US-Software for European Residents is filling in the "required Field" Zip-Code. eg. In Germany each town or area has its own 5-digit [0-9] zipcode ( 20032 Hamburg, 76135 Karlsruhe etc). I hate not to be able to register somewhere just because german zipcodes are only 5 -digits long.

Telephone codes are very different depending on the country you are.
1. 1-4 digits int. access (in Germany 00, in France 019)
2. 1-2 digits int country code (1 = US, 49=Germany, 33=France, 56=Chile)
3. provider codes / area codes / city codes / tel-number ( i don't know the maxlength)

to read these numbers easy Germans put spaces between ( 0049 721 923 32...) the French seperate them with dots (0033.33.255.12345) they read like IP's.

I never accept anything than [0-9] in my programs for tel. numbers.

I hope it helps, Alex
Quote Reply
Re: user regexps In reply to
Greetings Jerry!

New Zealand addresses can read either way. Internally we would normally write an address such as this.

Ian Conza
190 Weymouth Road
Manurewa

We only would add the major city if we did not live in that city. In this case "Auckland"

Also our zips are only four digits - like 1730.

Hope that helps.

------------------
www.nzcid.godzone.net.nz
New Zealand Christian Internet Directory