Skip to main content
Legacy User
February 7, 2018
Solved

Regex Formatting

  • February 7, 2018
  • 4 replies
  • 234 views

I have a Regex validation expression to validate phone numbers.  2 questions:

1.  Can I add the substitution code to format the results? For example Phone number validation ^\\(?([0-9]{3})\\)?[-.●]?([0-9]{3})[-.●]?([0-9]{4})$

want to add replace ($1) $2-$3 to format the validated numbers.

2.  Would the field be text or number?

Best answer by Community Expert

The field would be a text field and the text type under Validation would be Custom not Text or Number. Test your expression out within any Regex library. 

But as far as I can test myself, DocuSign does NOT suppot change and replace within a Regex expression. Let me know if you're able to get it to work.

Hope this helps.

4 replies

Legacy User
February 9, 2018

Hi,

Welcome back to the DocuSign Support Community!

If you go to https://regexr.com/, you'll be able to determine what would be best to use. The answer to the 2nd question would be a text field with the validation is numbers.If you have further questions, please let us know. Thank you. 

 

Donna DocuSign Support Community Moderator 

Legacy User
February 12, 2018

I'm sorry I wasn't clear.  Does DocuSign support replace to change format after passing validation?

Docusign Employee
February 14, 2018

The field would be a text field and the text type under Validation would be Custom not Text or Number. Test your expression out within any Regex library. 

But as far as I can test myself, DocuSign does NOT suppot change and replace within a Regex expression. Let me know if you're able to get it to work.

Hope this helps.

Conversation Starter
June 24, 2025

The following expression passes the test at https://regexr.com/ for a North American telephone number:

^(\+\d{1,2}\s?)?\(?\d{3}\)?[\s.-]?\d{3}[\s.-]?\d{4}$
 

However, my docusign text field with custom validation does nothing and is allowing any format.

-David