Regex to match only numbers in currency

自作多情 提交于 2021-02-10 05:15:08

问题


I'm trying to get a VB regex to match only the numbers in a currency sequence without additional substitution lines if possible. It needs to look for a number with + on end $ at the start and return what's in the middle, minus any commas.

Accordingly

 $10,000+ match returns 10000

$20,000+ match returns 20000

$30,000+ match returns 30000

$1,000,000+ match returns 1000000

$10,000 (anything without the trailing +) should *not* match

I can easily get the match to the value but I can't figure out how to get rid, of the trailing + or the prefix and commas inside.


回答1:


Your regex is \$(\d+(,?\d+)*)\+. Group 1 is what you are looking for
Check here

After retrieving results you should remove commas from it



来源:https://stackoverflow.com/questions/40071560/regex-to-match-only-numbers-in-currency

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!