I am building an incredibly large and complex integration with DocuSign using their eSignature API. As part of this we are providing MANY fillable fields on a DocuSign form. I can pass a validation pattern (regex) to the DocuSign API for a field and it will do validation based on that pattern.
The issue I have run into, is any time that I need to use a '\' in my regex. From what it seems, to make valid JSON, there must be an even number of \ for example '\\d'
- but this doesn't make for a valid regex and so, nothing will satisfy it.
How can I build Regex that require a \ in them and send them via JSON. The charachters that I definitely need are periods and dashes, which I don't know how to show in a regex without the \ delimiter before them.
After finding that my code was having issues with these erorrs, I started playing around in post man experimenting. I've searched online but most anywhere I search it says that regex is code and that it shouldn't be sent. Of course if I had power over both sides I could remove the extra delimiter on the DocuSign side but because I don't have this power to manipulate the payload on the receiving side, I'm stuck.
//Here is an example of something that I would LIKE to sent via JSON, but my single '\-' on the validation pattern are making it not valid JSON and returning an error.
{
"xPosition": "41",
"recipientId": "1",
"validationPattern": "^[0-9]{3}\-[0-9]{3}\-[0-9]{4}$",
"validationMessage": "Please enter a 10-digit telephone number. (###-###-####)",
"documentId": "19305",
"fontColor": "Black",
"tabLabel": "partPhone",
"shared": "false",
"font": "ArialNarrow",
"name": "Telephone Number",
"locked": "false",
"required": "true",
"pageNumber": "1",
"yPosition": "329",
"fontSize": "Size10",
"disableAutoSize": "false",
"width": "161"
}
I expect to be able to send the example snippet to DocuSign and there be no error, further more, I expect the Regex that I pass to it when including \ to actually work properly.