I’m no regex expert but I’ve managed to fudge together what I thought would be a functional check for whether a form filler is trying to use new line characters in text fields. My regex is:
(?<=[^\r\n])\R(?=[^\r\n])
It looks like it should work:
But when I implemented the regex in my web form entering anything in the field results in the input failing the validation check:
What am I missing? Do web forms use new line characters as part of the field? Why would a single word with no spaces or anything match my pattern?
Can you explain the use case and why you want to filter out the new line breaks?
I came across the issue with new line breaks working with SharePoint, when the text field is defined as multiple lines of text. This can result in issues when you pass the values via API to Docusign.
Another use case I saw before is when people copy and paste data from an Excel file, where the data fields included line breaks, which caused some trouble with document generation and workflow processes in CLM.
Its because employees entering line breaks into the web form fields allowed text to escape the desired bounds of the defined area on the completed PDF agreement.
I did not figure out why my regex didn’t work, but I was able to accomplish the same end goal by simply changing the problematic fields to short text. This prevents users from entering new lines.
If your goal is to simply detect the presence of newline characters in any text input, a simpler approach might be more effective: [\r\n]
This pattern will match any occurrence of \r (carriage return) or \n (newline) in the input. This is generally sufficient for detecting newline characters in text fields.
If your goal is to simply detect the presence of newline characters in any text input, a simpler approach might be more effective: [\r\n]
This pattern will match any occurrence of \r (carriage return) or \n (newline) in the input. This is generally sufficient for detecting newline characters in text fields.
Can you explain the use case and why you want to filter out the new line breaks?
I came across the issue with new line breaks working with SharePoint, when the text field is defined as multiple lines of text. This can result in issues when you pass the values via API to Docusign.
Another use case I saw before is when people copy and paste data from an Excel file, where the data fields included line breaks, which caused some trouble with document generation and workflow processes in CLM.
Can you explain the use case and why you want to filter out the new line breaks?
I came across the issue with new line breaks working with SharePoint, when the text field is defined as multiple lines of text. This can result in issues when you pass the values via API to Docusign.
Another use case I saw before is when people copy and paste data from an Excel file, where the data fields included line breaks, which caused some trouble with document generation and workflow processes in CLM.
Its because employees entering line breaks into the web form fields allowed text to escape the desired bounds of the defined area on the completed PDF agreement.
I did not figure out why my regex didn’t work, but I was able to accomplish the same end goal by simply changing the problematic fields to short text. This prevents users from entering new lines.
It sounds like you initially tried to use a regex pattern to prevent new line characters in a form field, but it didn’t work as expected. The issue might be that web forms often handle text differently, and your regex could be matching unintended cases.
If changing the field to "short text" worked for your use case by preventing new lines altogether, that's a practical solution. Sometimes, simpler fixes like adjusting the field type can be more effective than complex regex patterns, especially when dealing with web forms.
If you still need to use regex in the future, you might want to double-check how the text is being processed and whether there are any hidden characters or formatting that could affect the regex behavior.
It sounds like you initially tried to use a regex pattern to prevent new line characters in a form field, but it didn’t work as expected. The issue might be that web forms often handle text differently, and your regex could be matching unintended cases.
If changing the field to "short text" worked for your use case by preventing new lines altogether, that's a practical solution. Sometimes, simpler fixes like adjusting the field type can be more effective than complex regex patterns, especially when dealing with web forms.
If you still need to use regex in the future, you might want to double-check how the text is being processed and whether there are any hidden characters or formatting that could affect the regex behavior.
How would I double check how web forms process text? It would be helpful to know this for the future.
You can login or register as either a Docusign customer or developer. If you don’t already have a Docusign customer or developer account, you can create one for free when registering.
Join the Docusign Community by logging in with your Docusign developer or customer account credentials.
Don’t have an account? You can create a free one when registering.
Note: Partner-specific logins are not available yet. Partners should log in as either a customer or developer
Docusign Community
You can login or register as either a Docusign customer or developer. If you don’t already have a Docusign customer or developer account, you can create one for free when registering.