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
ppr
(Peter Preuss)
2
EDIT:
has an open door on dot only values
Otherwise, we can also think about the usage of Double.TryParse method
Or
^[\d.]+$
Using this and it matches my usecase.
Thank you
ppr
(Peter Preuss)
5
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
system
(system)
Closed
7
This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.