Select to view content in your preferred language

trouble with regex expression returning invalid value after version 3.17 update

449
2
02-23-2023 04:09 PM
AndreaPecharich
Occasional Contributor

We use the expression regex(., '^\d{0,2}(?:\.\d)?$') in the constraint column for a field where we want to drop the trailing decimal and zero from a value, but only when the number after the decimal is a zero. For example the input value of 255.0 would return 255, the input value of 82.0 would return 82, and the input value of 129.1 would return 129.1. This has been working well, but after the software version on our device was updated from 3.16 to 3.17 we now get an invalid value error when the input value is xxx.0, xxx.x but not xx.0. The data type for the output field is set to decimal. We would like to continue using the regex - is there a way around the invalid error?

0 Kudos
2 Replies
DavidSolari
Frequent Contributor

Does this work?  regex(., '^\d+(?:\.\d)?$)

0 Kudos
AndreaPecharich
Occasional Contributor
Yes - after I updated your expression to regex(., '^\d+(?:\.\d)?$') it worked great. Thanks!
0 Kudos