I have an even easier solution - why not just use three form fields, run a reg exp test on each individually for appropriate # of digits and then concatenate with "-" prior to insert? <input type="text" name="area" size="3" maxlength="3"> - <input type="text" name="prefix" size="3" maxlength="3">- - <input type="text" name="suffix" size="4" maxlength="4">