JSUTIL Field Validation using Regex on Story Points

sjwhyter June 12, 2015

I want to limit the value of story points to 1.2 or 3, so I have added a Regular Expression check of 

[1-3]

But when I enter a valid number, the validation fails.

3 answers

1 accepted

2 votes
Answer accepted
sjwhyter June 13, 2015

When processing the validating the value, some where during the transition the value I typed 3, became 3.0 and the regular expression of "[1-3]" failed. I changed it to "[1-3](?:\.[0-9])?" and it works.

Steven F Behnke
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
June 15, 2015

Steven, all number fields in JIRA are doubles. Apparently your regex validator didn't like comparing integers to doubles. :) https://docs.oracle.com/javase/tutorial/java/nutsandbolts/datatypes.html

0 votes
sjwhyter June 13, 2015

Steven thanks for putting me on the right path. When I looked at the transition screen, I saw the message Field Story Points with actual value 3.0 does not match regular expression "[1-3]" I figured it out the issue.

Andrew Ripley July 5, 2018

Hey Steven,

 

Would you mind elaborating on how you fixed this? I'm having the same issue the expression I used, Option [1,2,3,5,8,13,20], resulted in the same error message stating that the numbers need to be 1.0 (when I entered 1). When I tried entering 1.0 in the field, I still got the same error message. And, again, I got the same message when I updated the expression to be: Option Option [1.0,2.0,3.0,5.0,8.0,13.0,20.0]

0 votes
Steven F Behnke
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
June 12, 2015

Could you add an image of the validation failing? I assume it throws an error...

Suggest an answer

Log in or Sign up to answer