Skip to main content
Participant
Feb 5, 2024 10:17 PM UTC
Question

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

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 is closed to new replies. Start a new post to keep the conversation going.