I am trying to create a regular expression to validate a code. The rules are as follows:
- It starts with a B or J or 28
- Total length of the string must be either 7 or 13 characters (including starting characters)
- The characters following the starting characters must be all digits
Can anyone help me with this ? Thanks
I tried something like
$pattern = "/^((J|B|28)([0-9])({7}|{13})?/i";
But it doesn't seem to work :\