BUG: Variables: Illegal Characters without Warning (Via: `Search Using RegEx` action)

The Search Using Regular Expression action doesn't indicate the use of illegal characters when setting variable names of captured groups:

(Set Variable to Text is correctly indicating the use of an illegal character. A hyphen - in this case.)

Illegal characters I've tried:

` (backtick)

A problem for at least two reasons:

  • Doesn't indicate the illegal characters (duh).
  • Fails silently.
    • You can run the macro without receiving any error.
    • So it would seem that variable was set.
    • But it isn't (I checked in Preferences > Variables).


  • 8.2.2
  • But I found it in 8.0.4

Related but different:

  • Set Variable to Text action: Enter illegal character -
  • RESULT: Text turns red.
  • Switch to edit another macro.
  • Return to the original macro.
  • RESULT: The text is no longer red.
  • The only way to make it red again, is to add or remove characters from Set variable field.

I can imagine why this might be the intended behavior. But on first glance, it would seem that it should stay red (indicating the error) until it's corrected.

So I'm just mentioning it in case it's not intended.



Noted. Thanks.

1 Like

Good catch! Thanks for reporting. :+1:

This should be resolved in the next version.

The Search using Regular Expression action will report invalid variables in red, and variables entered in red like that will not be saved, so unless corrected to a valid variable, they will remain at their previous valid value.


Just tested this in Version 9.0.1 (Sorry it took me so long).

Better, thanks!

One thing:
It doesn't automatically apply to existing actions.

I opened the exact same macro that I used in the original post and the invalid variable values were black.

Focusing the field wasn't enough. I had to add/delete a character for Keyboard Maestro to re-evaluate it and change the text's color to red.

I wouldn't be surprised if you already knew this and it had to be this way for some other reason. But I thought I'd report it, since I wouldn't be surprised if this is something of an edge-case.

Thanks again!