The above formula works great if the digits will only be two numbers, i.e. E12-87 but not if you need to get E12-172. I changed (see bolded 2,3) the first line of javascript to the formula below to include numbers 01 thru 999, i.e. E12-109. The code seems to work fine.var pattern = /\bE\d{2}-\d{2,3}...