I have a text box that in Holland will contain RENT Value of 12522,15 and in the UK version of the same Power App it will be 12522.15 . So I need a check on this text box to send out a warning message that the number if not in 2 decimal places . I cannot currently get the below formula to work with both scenarios . Any ideas ?
Psedu Code
If it is a Dutch number format , it will have a , in the number . Do the Dutch check to see if it is 2 dp then send out warning message.
If it is a UK number format , it will have a . in the number . Do the UK check to see if it is 2 dp then send out warning message .
On Select property of TEXT BOX
If ( IsMatch(DataCardValue11_3.Text, "\d (\.)?") ,
If(!IsMatch(DataCardValue11_3.Text, Language(),"\d (\,\d{0,2})?)?") ,Notify("Rental Value must be to 2 decimal places", NotificationType.Warning) ) ,
If ( IsMatch(DataCardValue11_3.Text, Language(), "\d (\.)?") , If(!IsMatch(DataCardValue11_3.Text, Language(),"\d (\.\d{0,2})?)?"),Notify("Rental Value must be to 2 decimal places", NotificationType.Warning) ) )
)
CodePudding user response:
Why not single regex for both cases?
'^\d [\.\,]\d\d$'
It'll only match when there's exactly 2 decimal places after .
or ,