Simple Integer or float regexp

/^(\.?[0-9]+)$|^([0-9]+(\.[0-9]+)?)$/

It’s by no means perfect (will allow 0000001, 000, 1.0000, 0.0), but it’s not bad for general purpose.

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.