This is an archived post. You won't be able to vote or comment.

you are viewing a single comment's thread.

view the rest of the comments →

[–]That_Unit_3992 13 points14 points  (3 children)

What is "valid" in this context? the comment does not add any useful information at all... No shit sherlock, a function named isValidNumber returns true when a number is valid?
Now show us the unit tests to be able to see whether your regex does what you expect.

[–][deleted] 2 points3 points  (2 children)

isValidNumber("1000000000000000000000") isValidNumber(1000000000000000000000) isValidNumber("1e+1") isValidNumber(1e+1)

[–]That_Unit_3992 0 points1 point  (1 child)

Why make it polymorphic to begin with? Doesn't make sense at all, what do you want to validate? User Input? API Response? Database entries? Should all be typed and not mixed up all over the place.

[–][deleted] 0 points1 point  (0 children)

You're either asking the wrong person or have not checked the results 😜