c#正则表达式匹配整数和⼩数c#中使⽤正则表达式需要加⼊using System.Text.RegularExpressions的引⽤
匹配整数的⼀种表达式:
Regex.IsMatch(inputerstr, "^([0-9]{1,})$")
其中Inputerstr是要匹配的字符串
这个表达式仅匹配整数,如果是整数形式返回true,否则为false
匹配⼩数格式的表达式:
Regex.IsMatch(inputerstr, "^([0-9]{1,}[.][0-9]*)$")
其中Inputerstr是要匹配的字符串
这个表达式仅匹配数字中有⼩数点格式的数字,如果是带有⼩数点格式的纯数字,返回true,否则为false。
>python正则表达式匹配小数