AnsweredAssumed Answered

REGEX on decimal number

Question asked by nRogerGouv on May 15, 2018
Latest reply on May 15, 2018 by nRogerGouv


I am trying to do a regex constraint on a field of type "decimal".

The regex is the following: regex(.,'^[+-]?[0-9]{1,2}\.[05]$')

What this says is that i want a number to looks like this: 10.5 or 6.0 etc..


The problem is that the regex evaluate to false when i place a 0 at the decimal. It correctly evaluate to true if the decimal is a 5.

If I use a field of type "text" the regex correctly understand the decimal 0 or 5, so the regex expression is correct. It seems to be a problem with fields of type "decimal".


Is there anyway to solve this? Is it possible to parse the number to text before evaluating it with the regex?



Ok this regex seems to work: regex(.+"",'^[+-]?[0-9]{1,2}(\.[05]{1})?$')


But somehow both regex I used allow for 10. or 5. for exemple (a number without any decimal)