I am having an input widget which is number type in mobile. I need a regex pattern for which the input should allow either a long integer or a decimal number which should have only one dot.
Hi Rajsekhar,
you can use forge component-
https://www.outsystems.com/forge/component-overview/2258/input-masks-mobile
Regax-
https://www.regextester.com/95625
IT will help you,
Regards
Rahul Sahu
Hello Rajsekhar.
The platform can check if it is a valid value for the destination variable. If it is of type decimal, only numbers will be accepted.
If the variable is text, you can use TextToDecimalValidate() or TextToIntegerValidate() functions. They work in mobile.
Nuno Reis wrote:
this approach seems more logical to me. if you have input you can validate decimal with this logic,
check this:
(?<=^| )\d+(\.\d+)?(?=$| )|(?<=^| )\.\d+(?=$| )
Rajsekhar K wrote:
Some regex :
\d (for anything)
(?<=^| )\d+(\.\d+)?(?=$| ) (for 1 and 1.2)
(?<=^| )\d+(\.\d+)?(?=$| )|(?<=^| )\.\d+(?=$| ) (for 1, 1.2 and .1)
(?<=^| )\d+\.\d+(?=$| ) (for 1.2)
As per my view you are looking for 2nd one
Hope this helps
Thanks
AD