Hello SO:
I am a bit rusty at PHP, so bear with me. I am making a simple email form that validates a few key pieces of data. One of these fields is the submitter's zip code. To validate this, I figured a regex would be simple since I am pretty confident the validation can be done in one line. Behold:
preg_match("^([0-9]{5}|[0-9]{5}\-[0-9]{4})$", $zip);
This should be working to match 12345 and 12345-6789. However, this does not happen. What am I overlooking here?
Thanks!