SoFunction
Updated on 2025-03-01

C# Regular expression matching integers and decimals

An expression that matches integers:

(inputerstr, "^([0-9]{1,})$")

Inputerstr is the string to match

This expression only matches integers. If it is an integer, it returns true, otherwise it is false

Expressions matching the decimal format:

(inputerstr, "^([0-9]{1,}[.][0-9]*)$")

Inputerstr is the string to match

This expression only matches numbers in the number with decimal form. If it is a pure number with decimal form, it returns true, otherwise it is false.