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
AUG Leaders

Atlassian Community Events