Match Symbols, Brackets with one hotkey

This will probably be my most used and most useful macro, thank you @peternlewis for showing me how you can do this. I just want to make it a little bit more robust. Right now I have this :

And this works wonderfully if I type my trigger and press my character trigger and press my hotkey straight away. I can press left bracket, my hotkey trigger and I am in-between the brackets and thus I have saved me some time. There can also be a case where I opened my bracket, typed some words and letter characters and want to close my bracket now that I forgot but now if I press the trigger, it closes the brackets but also moves pointer to the left every time.

Would it be possible to extend this macro to accompany these cases? Essentially, if character string is typed and trigger is pressed right away, it will do one action. If character string is pressed and some other letters are typed that are also not any of these characters :

It will activate another action, in my cases it would just be closing the bracket and not moving the pointer. I would think I would need to perhaps use some regex for this but I both not really sure where to apply this regex and what regex would that be.

1 Like