Create Two Variables Simultaneously in Search Using Regular Expression Action

Firstly: regex is so wonderful once you understand it.

Secondly: I just stumbled upon a method to create two identical variables simultaneously (see attachment). It uses the fact that capture groups in regex can be nested, and if you just nest them with nothing distinguishing the inner from the outer you can get two fields to create variables, and they will by definition hold the same value.

*This is useful for me here because I'm continuously improving macro logic and it just so happens that with this particular path through the macro I want those variables to hold the same text, but with other paths I typically don't, so it wouldn't make sense to just have one variable. Furthermore, this technique saves me from having to have another "set variable b to a" action.

Search using Regular Expression.kmactions (673 B)
Keyboard Maestro Export

2 Likes

Amen.

Clever...

:sunglasses: