Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ISNUMBER returns true only if the text contains at least a decimal separator #13

Open
gbellini79 opened this issue Apr 6, 2023 · 1 comment

Comments

@gbellini79
Copy link

gbellini79 commented Apr 6, 2023

Hi @matheval,

it looks like the ISNUMBER(value) function returns true only when the text is a number with a decimal separator.
The regex used to check the value is /^-?\d*(\.\d+)+$/ with the (\.\d+)+ bit meaning one or more group of characters consisting of a point and one or more digit.

I think something like this could work better: /^-?\d*\.?\d+$/
Or, if you want to accept numbers with a trailing dot like "123.", you can change the last \d+ to \d*: /^-?\d*\.?\d*$/

Example: regexr.com/7bkvf

As a workaround I had to use ISNUMBER(CONCAT(value, '.0')).

Thank you in advance

@gbellini79
Copy link
Author

I submitted pull request #14 that should fix this issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant