Quick regex question (since i am horrible at it)
I have a field that can only have either:
XXXXXXXXXX or XXXXXX-XXXX where X is a real number.
Bonus if the regex works well with PHP’s regex functions.
The Answer:
Here’s the code from RoBorg’s answer, for those interested.
if(!preg_match('/^\d{6}-?\d{4}$/', $var)) { // The entry didn't match }
That’s