317
Views
5
Comments
Hi, I need a regex pattern, which allows only a single "." for a number.
Question

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.

2026-02-26 06-29-24
Rahul
 
MVP

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

2016-04-22 00-29-45
Nuno Reis
 
MVP

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.

2019-07-26 07-21-47
Abdul quadir Saifee

Nuno Reis wrote:

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.

this approach seems more logical to me. if you have input you can validate decimal with this logic,


2019-07-26 07-21-47
Abdul quadir Saifee

check this:

(?<=^| )\d+(\.\d+)?(?=$| )|(?<=^| )\.\d+(?=$| )

UserImage.jpg
Ashish D

Rajsekhar K wrote:

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.

 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

 

Community GuidelinesBe kind and respectful, give credit to the original source of content, and search for duplicates before posting.