Restrict special characters in the Description of Jira work items
Platform Notice: Cloud Only - This article only applies to Atlassian products on the cloud platform.
Summary
This article explains how you can restrict special characters in the Description field while allowing A-Z, a-z, 0-9, and set a character limit of 250 when creating a work item.
Solution
Use regex and a workflow validator
Navigate to the workflow of the work type where you want to implement this change.
In diagram mode, click the Create transition arrow.
This is the arrow line that leads to the first status of the workflow.
On the pop-up, select Validators.
Click Add Validator.
Choose Regular Expression Check and click Add.
Configure the validator as follows:
Field to validate: Select "Description".
Regular expression: Use
[\w\r\n,. ]{1,250}
.
Click Add to save.
Publish the workflow to apply the change.
This will make it so that when a user enters a special character that is not allowed, an error message will appear: Your request could not be created. Please check the fields have been correctly filled in. Field Description with actual value 'Test!' does not match regular expression [w/r\n, 1{1,250}
Working with regex
The regex used above ([\w\r\n,. ]{1,250})
allows the following:
Characters A-Z, a-z, 0-9.
Special characters: ".", ",", space, and new lines.
A maximum character limit of 250.
Some other options are:
To also allow the "@" character in the "Description" field, use the following regex:
[\w\r\n,. @]{1,250}
.
If you want to increase the character limit to 400, use this regex:
[\w\r\n,. @]{1,400}
.
This method can be applied to restrict or validate other fields as well.
Was this helpful?