Why doesn't JIRA Regular Expression Check validator work as expected on numbers over 9,999,999?

Hi all,

I am using JIRA Cloud and I have a custom field on on my "Create" and "View" screens called "Cost", it is a Number Field.

I have removed the "Cost" field from the Edit screens for the issuetype. The reason for this is that I don't want users to edit the field later on in the workflow in order to skip some of the checks and balances that I have in place for the value in this field (certain approvals are required depending on cost).

So how do the users specify cost at all? Well, I associate a screen with transitions at the start of the workflow asking the user to specify a cost:

Screen Shot 2017-07-07 at 19.29.50.png

In the early part of the process, they can specify the cost if they know it. The cost may be up to several tens of millions. If they don't know the cost at that point they can leave it NULL for the time being, or put it to zero, I don't mind and I don't check the value as it passes through those early transitions. Leave it NULL, make it zero, make it 20,000,000 (commas included for readability only) I don't mind.

However, at a certain point in the workflow, I want to ensure that the value is not NULL and is greater than zero. The not NULL validation check is easy using a "Field Required" validator:

Screen Shot 2017-07-07 at 19.34.45.pngHowever, this does not check for the value zero, it is only checking for NOT NULL.

Remember, I want this transition to be possible (i.e. draggable on an Agile board), so I cannot use a Condition Validator that says "Cost > 0" - because if it's zero, then the transition is not even available - you will not be able to drag it to the next column on the board.

Therefore, I need a validator. As already shown, the "Field Required Validator" is only checking for a value, it does not check for numbers greater than zero.

The only option I see to perform this validation is the "Regular Expression Check" validator:

Screen Shot 2017-07-07 at 19.39.35.pngSo I enabled this and gave it the following regular expression:

^([0-9]*[1-9][0-9]*(\.[0-9]+)?|[0]+\.[0-9]*[1-9][0-9]*)$

I tested this RegEx on a few online RegEx sites and it seems to do what I want, i.e. it won't allow zero, but will allow numbers above zero as well as values like 100.50, 100000.99 and such like.

However, when I put this Regular Expression into JIRA as a validator:

Screen Shot 2017-07-07 at 19.52.17.png

Everything appears to work fine until you reach larger values. When the cost is 9,999,999.99 (I put the commas in for readability only) it passes the validator.

However, as soon as the cost value reaches 10 million the validator fails with the following message:

Screen Shot 2017-07-07 at 19.55.34.png

Not only is the validator message GOD AWFUL and not changeable, why on earth is it failing when it reaches 10 million? The RegEx looks fine.

I assume JIRA is doing something stupid with the value internally, converting it to exponential format (1.0E7) when it reaches 10 million which is then causing the RegEx validator to fail.

How can I overcome this scenario? Any advice is much appreciated!

Gary

1 answer

1 vote

Hi Gary,

With numbers that large the code base appears to translate into Scientific notation.  Try the following regex for scientific notation:

[-+]?[0-9]*\.?[0-9]+([eE][-+]?[0-9]+)?

You can use this StackOverflow article for reference.

In regards to getting the message changed, I would go to JAC and create a Suggestion ticket. 

Cheers,

Branden

Thanks Branden :)

I also raised this issue with Atlassian, which is related: https://jira.atlassian.com/browse/CONFCLOUD-57634

It would be nice if it rendered as it does in a JQL search.

Gary

Suggest an answer

Log in or Sign up to answer
How to earn badges on the Atlassian Community

How to earn badges on the Atlassian Community

Badges are a great way to show off community activity, whether you’re a newbie or a Champion.

Learn more
Community showcase
Published Jun 14, 2018 in Jira Service Desk

How the Telegram Integration for Jira helps Sergey's team take their support efficiency to the bank

...+ reading Fantasy). The same is true for him at the bank he works for: Efficiency is key when time literally equals money. Read on to learn how Sergey makes most of the time he has by...

463 views 2 4
Read article

Atlassian User Groups

Connect with like-minded Atlassian users at free events near you!

Find a group

Connect with like-minded Atlassian users at free events near you!

Find my local user group

Unfortunately there are no AUG chapters near you at the moment.

Start an AUG

You're one step closer to meeting fellow Atlassian users at your local meet up. Learn more about AUGs

Groups near you