Author: bvaland80 | Posted on: 4/2/2009 5:00:08 AM | Views : 320

Hi Experts
I would like to validate the postcode once submitted, i have searched online and found the code asp and php.
Can someone help me to convert the below code to vb.net?
  
function isValidPostCode(postCode)
dim regEx

set regEx = new RegExp

with regEx
.IgnoreCase = true
.Global = true
.Pattern = "^([A-PR-UWYZ]([0-9]{1,2}|([A-HK-Y][0-9]|[A-HK-Y][0-9]([0-9]|[ABEHMNPRV-Y]))|[0-9][A-HJKS-UW])\ [0-9][ABD-HJLNP-UW-Z]{2}|(GIR\ 0AA)|(SAN\ TA1)|(BFPO\ (C\/O\ )?[0-9]{1,4})|((ASCN|BBND|[BFS]IQQ|PCRN|STHL|TDCU|TKCA)\ 1ZZ))$"
end with

if regEx.Test(trim(CStr(postCode))) then
isValidPostCode = true
else
isValidPostCode = false
end if

set regEx = nothing
end function 
I have found the code at ...

Go to the complete details ...