rodrigosantosbr

Integer Numbers Regex

Jan 15th, 2019
69
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!

Integer Numbers Regular expression:

This will check if a number is an integer.
Positive integers are all the whole numbers greater than zero: 1, 2, 3, 4, 5, ... .
Negative integers are all the opposites of whole numbers: -1, -2, -3,-4, -5, ... .
Zero is not a whole number with either a positive or negative value, and is not an interger.
Null or Empty values are not intergers.

Site: https://regex101.com/


Expression:

[-+]?[1-9]\d*\.?[0]*

Example text:

Nasci em 10 de janeiro de 1986.

Expression:

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

Example text:

10
1986
Pedro
10Pedro
Add Comment
Please, Sign In to add comment