Hi,

I'm have a small problem trying to validate a UK Postcode, I've ported over several regex searches from some of my PHP scripts, to validate things like e-mail addresses, etc..
But for some reason I'm unable to get my UK Postcode validation to work.

// Declare and Initialize the variables to use.
Dim Reg as New RegEx
Dim FoundMatch  as New RegExMatch

// UK Post Code search pattern
Reg.SearchPattern = "^[A-Z]{1,2}[0-9][0-9A-Z]?\\s+[0-9][ABD-HJLNP-UW- Z]{2}$"

// Check for a match on Post Code
FoundMatch = Reg.Search( "GL2 4XR"  )

// Check to see if we have found a match
if ( FoundMatch <> nil ) then
MsgBox "Match"
Else
MsgBox "No Match"
End If

Could anyone advise me where I may be going wrong.

Thanks

Mark
_______________________________________________
Unsubscribe or switch delivery mode:
<http://www.realsoftware.com/support/listmanager/>

Search the archives of this list here:
<http://support.realsoftware.com/listarchives/lists.html>

Reply via email to