I believe that instead of /$[,\d]+.\d\d/, /$\d+.\d\d/ is sufficient.

The [,\d]+ is necessary to allow for multiple digits (and grouping) before the decimal point. Your suggestion matches prices with exactly one digit before the decimal (and no grouping markers), so $9.99 and $4.32 match but $15.99 and $1,099.45 would not.

Note that $[,\d]+.\d\d isn’t totally correct, either: it matches incorrect prices like $5,4,,3.79 or $,.45. A more precise regex is $\d{1,3}(,\d{3})*.\d\d, but this still allows $00,123.45. The correct regex is left as an exercise for the reader… 8^)

multiple digits PLUS grouping, you mean! But thanks for the clarification! I forgot about the ‘number_to_currency’ helper, and the ‘,’s, that it introduces…

And yeah, apparently I mistyped my alternative regex (my bad!). Definitely should have a plus behind the first ‘\d’ (of course?)!