问题
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