[英]C# Regex match commas and decimals
I am trying regex to match decimals and commas. 我正在尝试使用正则表达式来匹配小数和逗号。 Code will take Bitcoin wallet account balance from API, what example would be
0.003827385,
How could regex match number like that? 代码将从API中获取比特币钱包帐户余额,哪个示例为
0.003827385,
正则表达式如何匹配这样的数字?
this should do it: 这应该做到这一点:
Regex.Match(SearchString,"[0-9]+\.?[0-9,]*");
https://regex101.com/r/fP5jI7/2 https://regex101.com/r/fP5jI7/2
Why don't you just try a regex to match decimals? 为什么不尝试使用正则表达式来匹配小数?
([\d+[,\d]*]*\.\d+)|[\d+[,\d]*]*
Your question is not clear about usage of commas. 您的问题不清楚逗号的用法。 Note the above regex will not match commas after decimal point.
请注意,上述正则表达式与小数点后的逗号不匹配。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.