I need regex for integer number or decimal number with .0
approved:
35
35.0
not approved:
any other decimal (35.7, 35.989)
>Solution :
One way:
^\d+(?:\.0)?$
^– start of line anchor\d+– one or more digits(?:– start of non-capturing group\.0– A literal.followed by0
)– end of non-capturing group?– 0 or 1 match of the previous match (the non-capturing group matching on\.0)$– end of line anchor