RegEx Hurting My Brain

Macro below figures sum of items and then adds tax.
It displays the totals fine. It goes into the clipboard fine.
Problem is it pastes eg:
$2.38 or 2.383456 and I want it to paste 2.38
No $ and rounded to 2 digits

Tried several Regex and other stuff. I'm stuck. (Group labeled New Stuff)

Appreciate any help. Thanks

Download Macro(s): Sales Reciept Calculator.kmmacros (8.1 KB)


  • Macros are always disabled when imported into the Keyboard Maestro Editor.
    • The user must ensure the macro is enabled.
    • The user must also ensure the macro's parent macro-group is enabled.
System Information
  • macOS 12.6.3
  • Keyboard Maestro v10.2

Hey Steve, does this work?

Sales Reciept Calculator Ver 2.kmmacros (8.2 KB)



It goes onto the clipboard in the format you've told it to -- if that includes the currency symbol, the clipboard will have the currency symbol. If you only want numbers, formatted to two decimal places, on the clipboard then use %CalculateFormat%Item_SumTax%#,##0.00%:


I'm not sure if you actually want the "Total with Tax" Display Text action, or if that's just for debugging. But you can do the calculation and set the clipboard in a single (if rather long) operation:

%CalculateFormat%(Item_1 + Item_2 + Item_3 + Item_4 + Item_5) * 1.07%#,##0.00%


1 Like

Hey Steve,

Keep in mind that it's often easier to visualize calculations using the Set Variable to Calculation action.

โ€œWith Formatโ€ is an option in the action's gear and contextual menus:


I for one find these easier to read than embedded text-token-calculations, so I never use the latter except when it's especially convenient to do so.



Works perfectly. Thanks.

This shows me simple is better.
Can't believe I didn't realize that this symbol ยค was the $. DUH!!
73 year old brains sometimes don't work.
Thanks for the reply.

Great tip! I don't fool with numbers very often and had forgotten about this action.
I also was not aware of the w/Format option in the gear.
Need to look inside those 'blue colored' gears more than I do. :sunglasses:


1 Like