| Title | 
                
                    Test
                    Find
                    
                    Pattern Title
                 | 
            
            
                | Expression | 
                ^[a-zA-Z]{1,2}[0-9][0-9A-Za-z]{0,1} {0,1}[0-9][A-Za-z]{2}$  | 
            
            
                | Description | 
                Matches UK postcodes according to the following rules
1. LN NLL     eg N1 1AA 
2. LLN NLL    eg SW4 0QL 
3. LNN NLL    eg M23 4PJ 
4. LLNN NLL  eg WS14 0JT 
5. LLNL NLL   eg SW1N 4TB 
6. LNL NLL     eg W1C 8LQ
Thanks to Simon Bell for informing me of LNL NLL rule for postcodes which I had omitted in an earlier version.
  | 
            
            
                | Matches | 
                G1 1AA | EH10 2QQ | SW1 1ZZ  | 
            
            
                | Non-Matches | 
                G111 1AA | X10 WW | DDD 5WW  | 
            
            
                | Author | 
                
                    Rating:
                        
Not yet rated.
                    Dave Sparks
                 | 
            
            
                | Source | 
                 | 
            
            
              | Your Rating | 
              
                
		       | 
            
        
    
 
    
    
     
        
                
	                Title: Good but space match confuses Expresso
	                Name: Matthew Harris
	                Date: 4/23/2013 5:01:52 AM
	                Comment: 
I use Expresso to test and it didnt like the space in the middle of the expression followed by a quantifier check {0,1}. I would convert this to \s to be sure or put it in a range [ ]{0,1}. The final regex that I have settled with is as follows: ^[A-Za-z]{1,2}[0-9][0-9A-Za-z]{0,1}\s{0,1}[0-9][A-Za-z]{2}$
                
                
            
                
	                Title: Mr
	                Name: Bond
	                Date: 4/13/2007 4:33:12 AM
	                Comment: 
Great Reg Ex. Are you able to add validation with East London post codes that start with E14P? Thanks.
                
                
            
                
	                Title: good
	                Name: frek
	                Date: 3/21/2007 11:20:08 AM
	                Comment: 
thank you
                
                
            
                
	                Title: mr
	                Name: pierre
	                Date: 9/1/2006 12:07:27 PM
	                Comment: 
your regular expression rules!
                
                
            
                
	                Title: Mr
	                Name: SkeanDu
	                Date: 1/22/2004 5:19:38 AM
	                Comment: 
A more comprehensive expression:
'UK Postcode
                Public Const rgxZIP_UK = "(?:(?:A[BL]|B[ABDHLNRST]?|" _
                & "C[ABFHMORTVW]|D[ADEGHLNTY]|E[CHNX]?|F[KY]|G[LUY]?|" _
                & "H[ADGPRSUX]|I[GMPV]|JE|K[ATWY]|L[ADELNSU]?|M[EKL]?|" _
                & "N[EGNPRW]?|O[LX]|P[AEHLOR]|R[GHM]|S[AEGKLMNOPRSTWY]?|" _
                & "T[ADFNQRSW]|UB|W[ACDFNRSV]?|YO|ZE)" _
                & "\d(?:\d|[A-Z])? \d[A-Z]{2})"
                
                
            
                
	                Title: Misses a common error
	                Name: Julian Gall
	                Date: 9/1/2003 9:33:58 AM
	                Comment: 
One very common error in UK post codes is to write SO1 1AB (Southampton) as S01 1AB (i.e. S zero, not S Oh). This regex matches both when it should only match the first
                
                
            
                
	                Title: s ucikvo
	                Name: uobuo
	                Date: 8/9/2003 12:54:13 AM
	                Comment: 
ici vldi oa i ovs a izbiyiocv io  uvilbi
aiciovis  ivis ivn  iw jmxc}}asiovo a inso iom
 juko o coas  oa mmdf i odm uiqoo iozambmd
i ciiop kmnm
ofoaiodo  iodfvis i ko  bi i mm
s i  iow  s  ui bos wnmvobida i ui o vl   a id
nnmf fmnmm od  ioumdfovmvnmb
nfnnmd
                
                
            
                
	                Title: Can be more specific
	                Name: Michael
	                Date: 6/25/2003 4:59:53 AM
	                Comment: 
The walk part of a UK postcode (the last two letters) never include the letters C I K M O V.  It would also not be too difficult to add specific checking for valid areas (the first two letters) as there are only around 120 of these.
                
                
            
                
	                Title: No good for BFPO codes
	                Name: Egghead
	                Date: 4/14/2003 6:50:03 PM
	                Comment: 
You may want to include the standard postcide for the British Forces Patrolling Overseas which takes the format: BFPO ##