I'm using 'Enter' because I'm trying to enter codes with just the keypad - the left hand is busy setting off midi triggers.
My hope is not to need to move my hands at all. The enter key has the feel of being 'done' (like the '=' on a calculator) so it just feels like the natural end to all the codes.
Using * at the end works, but it's an unnatural hand motion
Did you configure the trigger as a "regular expression matches"?
It works fo me. BTW, you do NOT type the backslashes when using.
Just type: -7- and then the ENTER key.
In Pages, that solution works for the Return key, but not for Enter.
But - I'm trying to get it to work inside Finale, and I don't think it recognizes any of this.
Can I ask a different question?
Another thought I had was to trigger the asterisk with a midi pedal to end each code. But, that isn't registering as part of the the typed string.
I would type -7-* where the * is a midi trigger.
It currently puts the asterisk where it should be, but won't trigger the macro.
I have found it is easier to always escape metacharacters than to remember the rules of when it is necessary, and when it is not necessary. It does NOT seem to harm the match to always escape them.
I've redesigned the shorthand to not include '0' so I can use it as the de facto ENTER key.
Finale didn't want to accept the real ENTER key in this situation, and well, who am I to argue?
The regex for the return key is \r. \R would presumably work as well.
The problem with this is that \ does not just escape all characters - for some characters it makes them mean something.
So while you're probably safe with the using \- in place of -, it's not guaranteed. Since - is just a regular character like any other character, it is not impossible that a future change or some extension would make \- mean something else in the same way that r is a regular character and \r means something else.
So while I understand the simplicity of just escaping everything, it has its own risks, especially with potential future compatibility.
The ICU documentation is explicit on which characters must be quoted, but not clear on what can safely be quoted.
/ quotes the following character. Characters outside of sets that must be quoted to be treated as literals are *?+[(){}^$|\.. Characters [inside sets] that must be quoted to be treated as literals are []\ and depending on the context are -&.
As an aside, I often use the more literal nature of inside sets to avoid excess use of backslash which otherwise can lead to Leaning Toothpick Syndrome by using regex such as [*] or [$].
Anyway, as long as you're comfortable with that possible future compatibility, it should be safe enough to just quote everything non-alphanumeric.
I use double dots to end a string trigger, for instance, I type “date..” to insert a date, “51..” to paste the answer for quiz 5, question 1, “add.." to paste my address, "km.." for keyboard maestro.
double dots are rarely used in my writing(typing), so its been working great for me.
The keypad has the dot. Maybe this option is worth considering for you as well.
I tried the dot - But I'm aiming for speed when typing these codes, and the ring finger on my right hand is not co-operating! It tends to hit every key but the one I tell it to hit.
I've settled on a similar idea to your suggestion but using '0' as the final character.
That is NOT what I do.
I only escape metacharacters when I need to match those characters as a literal.
And, since "-" is already a metacharacter, I think it is highly unlikely that a NEW metachar of \- would be added to the Regex language.
I find that harder to read, and requires more typing.
IMO, it is very clear that \* means the literal character *
Your use of [*] causes me to have to stop and think about what does that actually mean.
This is great - it works in every app but the one I need it to!!
At least not the ENTER key. But the 0 or .. work great.
(I'm trying to enter chords in to Finale, which isn't really text)
Thanks for everyone's help. I've learned some new stuff!