Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.php > #10587

Zip Codes ctype? Pregmatch?

From Twayne <nobody@spamcop.net>
Newsgroups comp.lang.php
Subject Zip Codes ctype? Pregmatch?
Date 2013-08-20 13:27 -0400
Organization Aioe.org NNTP Server
Message-ID <kv08v0$614$1@speranza.aioe.org> (permalink)

Show all headers | View raw


Hi all,

I'm attempting to check for US and Canadian zip codes (postal codes). 
The US is easy; mostly just be sure it's five numerics and except 
"00000" and "99999". But Canadian is a different story because:
    It consists of alternating alpha and numeric characters (AnAnAn) but 
not the entire alphabet. 8 N.A. English letters are not used, as in 
DFIOQUW AND Z or put another way, they only use 18 letters in their 
postal codes.
    I haven't see a single example in all my research to check if the 
1st, 3rd, and 5th characters are alpha and th 2nd, 4th and 6th 
characters are numeric.

I've tried preg_match and strpos without succees, likely due to my own 
weakness with preg_match, and regex creates an incredibly long statement 
I'm sure it's not right to put upon the servers; they slow down even my 
local server XAMPP & PHP 5.3 on win 7.

Might anyone have a better method?

Or know of any functions anywhere that could be modified to be used?

Back to comp.lang.php | Previous | Next — Next in thread | Find similar | Unroll thread


Thread

Zip Codes  ctype? Pregmatch? Twayne <nobody@spamcop.net> - 2013-08-20 13:27 -0400
  Re: Zip Codes  ctype? Pregmatch? Martin Leese <please@see.Web.for.e-mail.INVALID> - 2013-08-20 11:59 -0600
    Re: Zip Codes  ctype? Pregmatch? Twayne <nobody@spamcop.net> - 2013-08-20 15:01 -0400
  Re: Zip Codes  ctype? Pregmatch? Robert Heller <heller@deepsoft.com> - 2013-08-20 13:08 -0500
    Re: Zip Codes  ctype? Pregmatch? Twayne <nobody@spamcop.net> - 2013-08-20 15:03 -0400
      Re: Zip Codes  ctype? Pregmatch? Robert Heller <heller@deepsoft.com> - 2013-08-20 14:36 -0500
        Re: Zip Codes  ctype? Pregmatch? Twayne <nobody@spamcop.net> - 2013-08-20 20:17 -0400
  Re: Zip Codes  ctype? Pregmatch? RESOLVED Twayne <nobody@spamcop.net> - 2013-08-20 15:06 -0400
    Re: Zip Codes  ctype? Pregmatch? RESOLVED Norman Peelman <npeelman@cfl.rr.com> - 2013-08-20 19:53 -0400
      Re: Zip Codes  ctype? Pregmatch? RESOLVED Twayne <nobody@spamcop.net> - 2013-08-20 20:29 -0400
        Re: Zip Codes  ctype? Pregmatch? RESOLVED Moon Elf <moonelf@moonelfsystem.net> - 2013-12-16 10:02 +0000
          Re: Zip Codes  ctype? Pregmatch? RESOLVED Doug Miller <doug_at_milmac_dot_com@example.com> - 2013-12-16 12:27 +0000
  Re: Zip Codes  ctype? Pregmatch? Norman Peelman <npeelman@cfl.rr.com> - 2013-08-20 19:52 -0400
    Re: Zip Codes  ctype? Pregmatch? Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2013-08-21 14:53 +0200
      Re: Zip Codes  ctype? Pregmatch? Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2013-08-21 14:58 +0200
        Re: Zip Codes  ctype? Pregmatch? Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2013-08-21 15:06 +0200
          Re: Zip Codes  ctype? Pregmatch? Curtis Dyer <dyer85@gmail.com> - 2013-08-24 10:22 +0000
            Re: Zip Codes  ctype? Pregmatch? Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2013-08-24 12:52 +0200
            Re: Zip Codes  ctype? Pregmatch? Doug Miller <doug_at_milmac_dot_com@example.com> - 2013-08-25 14:31 +0000
              Re: Zip Codes  ctype? Pregmatch? Twayne <nobody@spamcop.net> - 2013-08-25 13:21 -0400
            Re: Zip Codes  ctype? Pregmatch? Twayne <nobody@spamcop.net> - 2013-08-25 13:17 -0400
      Re: Zip Codes  ctype? Pregmatch? Twayne <nobody@spamcop.net> - 2013-08-21 19:10 -0400
        Re: Zip Codes  ctype? Pregmatch? BootNic <bootnic.bounce@gmail.com> - 2013-08-21 22:09 -0400
          Re: Zip Codes  ctype? Pregmatch? Twayne <nobody@spamcop.net> - 2013-08-22 18:22 -0400
  Re: Zip Codes  ctype? Pregmatch? Jeff North <jnorthau@yahoo.com.au> - 2013-08-21 21:25 +1000
    Re: Zip Codes  ctype? Pregmatch? Twayne <nobody@spamcop.net> - 2013-08-21 18:53 -0400
      Re: Zip Codes  ctype? Pregmatch? Norman Peelman <npeelman@cfl.rr.com> - 2013-08-21 22:46 -0400
  Re: Zip Codes  ctype? Pregmatch? gordonb.qnlcm@burditt.org (Gordon Burditt) - 2013-08-31 01:17 -0500
    Re: Zip Codes  ctype? Pregmatch? Fiver <numeralfive@gmail.com> - 2013-08-31 16:40 +0200
      Re: Zip Codes  ctype? Pregmatch? Norman Peelman <npeelman@cfl.rr.com> - 2013-08-31 11:56 -0400
        Re: Zip Codes  ctype? Pregmatch? Welsh Vanner <welshvanners@welsh-vanners.co.uk> - 2013-08-31 20:23 +0100
        Re: Zip Codes  ctype? Pregmatch? Twayne <nobody@spamcop.net> - 2013-08-31 20:21 -0400
      Re: Zip Codes  ctype? Pregmatch? Martin Leese <please@see.Web.for.e-mail.INVALID> - 2013-08-31 09:56 -0600
    Re: Zip Codes  ctype? Pregmatch? Twayne <nobody@spamcop.net> - 2013-08-31 20:07 -0400

csiph-web