Create
cancel
Showing results for 
Search instead for 
Did you mean: 
Sign up Log in

Scriprunner code to validate regular expression using Match function

Priya ThirumalaiKrishnamoorth September 16, 2024

Hi, I need to validate a custom field value. The format is CRQ<0-9>. Total digits have to be 12. I used the below code.

if((issue.customfield_10063.match("CRQ[0-9]{12}")) ||

(issue.customfield_10063 == null)) {
           true
}
else {
       false
}
The script throws error if the field is blank
The scripts accept more then 13 digits as well and does not throw error
How do i ensure that it allows blank or accepts CRQ followed by 0-9 digits of length 12 only? 

0 answers

Suggest an answer

Log in or Sign up to answer
DEPLOYMENT TYPE
CLOUD
PRODUCT PLAN
PREMIUM
PERMISSIONS LEVEL
Product Admin
TAGS
atlassian, team '25, conference, certifications, bootcamps, training experience, anaheim ca,

Want to make the most of Team ‘25?

Spend the day sharpening your skills in Atlassian Cloud Organization Admin or Jira Administration, then take the exam onsite. Already ready? Take one - or more - of 12 different certification exams while you’re in Anaheim at Team' 25.

Learn more
AUG Leaders

Upcoming Jira Events