Go back to RegexSwap.

Integer or rounded decimal

Try it out on these example inputs:

Regular expression:

^[-+]?[1-9][[0-9]]*\.?[0]*$

Categories:

numbers

Popularity:

You need to be logged in to cast votes on regexes.

Good
1
Bad
0

Author description and comments (0)

Topic by
beno

2009-01-06
15:54

Description

This regex matches all positive or negative numbers that have no decimals or only zero's in the decimal numbers. Examples:
  • 1
    • -1
      • 12.0
        • -512.00
0

You need to be logged in to participate

In order to post your own comments on this regex, you need to be logged in.

Username:

Log in by clicking the login link at the top of the screen

Username:

Password:

Requested username:

Password:

Real name:

Email address:

Title:

Company:

Country: