Uipath Regex, should return True only if Integer or float

Hello,
I had raised a query few days back regarding to Check if a string contains only Numbers or no

For integers, this working fine ^\d+$ for integer value. But i need to work for floating number as well.

Now i need it to be modified a little, It should match only Integer or float, not alphanumeric or special characters

True for:
“120”,
“120.3”,

Fail for:

“120a” and “Test”.

1 Like

EDIT:

has an open door on dot only values

Otherwise, we can also think about the usage of Double.TryParse method

Or

@hansen_Lobo

Please try this

"^\d+(\.\d+)?$"

Cheers

^[\d.]+$

Using this and it matches my usecase.
Thank you

Have a look here:

we would recommend for using this instead of regex

When the regex pattern is used, then we recommend the more strict pattern from Anil

As

has an open door for the dot only value

1 Like

Thank you, will be using the regex given by Anil.

1 Like

This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.