Regex Using a Variable as Replacement Including Capture Group

Ok @Augustin I have the solution for you and it is based on the contents of this discussion in the KM forum:

I'll leave it to you to read and digest that discussion so you'll understand what's going on but the modifications to your macro consist of the two red-coloured actions in this new version:

Download Macro(s): Mise en forme | Anciens | Substantifs & adjectifs TEST v4.kmmacros (5.3 KB)

Macro-Image

Keyboard Maestro Export

Macro-Notes
  • 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 10.14.6
  • Keyboard Maestro v10.2