I am fairly new to RegEx and felt I somewhat got the hang of the basics when I was working with my .htaccess file. I am currently working on some form validation to check that the user inputs a valid serial number to the system. The system can accept the following serial format.
- I-SERIAL-123
- I-SERIAL123
- SERIAL-123
- SERIAL123
I am using the preg_match function to check whether this expression is satisfied, if so the field is submitted.
Current Expression
if (preg_match("^[A-Z0-9\-]{5}$", $_GET['serial']) === false)
However PHP keeps throwing an "No ending delimiter found" exception, I've looked at a couple of PHP cheat sheets and I don't see any immediate issues in my syntax.
Any pointers would be greatly appreciated, thanks.