Skip to main content
Participant
February 5, 2024
Question

Optional dash that gets added to the field after if no dash is entered.

  • February 5, 2024
  • 0 replies
  • 314 views

I'm working on validation for an EIN text field. The format is ##-#######.

In the webform, I'm using this custom - regular expression ^\d{2}-?\d{7}$

This acheives forcing ##-####### or #########, but I want to know if there's a way to make it that the dash will appear after the 2nd character if the user doesn't enter this in.

Does anyone know how to do this?

I know this is possible since I'm pretty sure other fields that are presets do this, like phone numbers.

Thanks in advance!

This topic has been closed for replies.