You can use
/^[A-Za-z0-9]{6}-\d{2}-[A-Za-z0-9]-\d{4}$/
Or shorter with the case insensitive flag:
/^[A-Z0-9]{6}-\d{2}-[A-Z0-9]-\d{4}$/i
Question
Need help creating a validation pattern in javascript for a field.
The value entered must be formatted as follows: xxxxxx-NN-x-NNNN
x = letters or numbers; N = numbers only
Pattern must include the dashes '-' at js positions 6,9,11.
Thanks in advance for your help.
Solution
You can use
/^[A-Za-z0-9]{6}-\d{2}-[A-Za-z0-9]-\d{4}$/
Or shorter with the case insensitive flag:
/^[A-Z0-9]{6}-\d{2}-[A-Z0-9]-\d{4}$/i