Here is the deal...
I am suppose to parse a Canadian Postal Code (CapsLetterNumberCapsLetterNumberCapsLetterNumber: exemple A1B2C3 or G2V3V4) IF there is one.
I have this code (PHP):
//Create new SESSION variable to store a warning
$_SESSION['msg'] = "";
//IF empty do nothing, IF NOT empty parse, IF NOT match regex put message in msg
if(!preg_match('^([A-Z][0-9][A-Z][0-9][A-Z][0-9])?$^', $_POST['txtPostalCode']) && $_POST['txtPostalCode'] != "")
{
$_SESSION['msg'] .= "Warning invalide Postal Code";
}
then the code goes on to display $_SESSION['msg']
.
The problem is that whatever I enter in $_POST['txtPostalCode'] it NEVER get parse by the REGEX.