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

small regex bug in number check #41

Closed
bentrombley opened this issue Feb 9, 2011 · 5 comments
Closed

small regex bug in number check #41

bentrombley opened this issue Feb 9, 2011 · 5 comments

Comments

@bentrombley
Copy link

Validator with {number: true} rejects floats without the leading 0 (e.g. ".3").

Current version and fixed version respectively (line 1022):
return this.optional(element) || /^-?(?:\d+|\d{1,3}(?:,\d{3})+)(?:.\d+)?$/.test(value);
return this.optional(element) || /^-?(?:\d+|\d{1,3}(?:,\d{3})+)?(?:.\d+)?$/.test(value);

-Ben

@MikeWills
Copy link

I have this problem as well. Makes for poor usability. Can this get added soon?

@jamesshannon
Copy link

Agreed. I was about to file a bug for this myself.

See http://goo.gl/eXr1D and http://goo.gl/Kap25 for the before and after test cases.

@MikeWills
Copy link

I have a pull request on this issue with the fix set as what @bentrombley specified as the fix.

@KennethScott
Copy link

I agree. Please fix.

@MikeWills
Copy link

Okay, I'll work on figuring it out.

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

Successfully merging a pull request may close this issue.

5 participants