The key event regex is being executed on the frontend, so start your research from “Javascript regex” or “EMCAScript regex”. For a practical starting point, I can’t recommend regex101.com
highly enough. E.G. for your example, I’d probably start from something like this:
Do note that for…complicated reasons, if you want to detect an enter keypress, you need to literally capture Enter
in your pattern. More on that here: Perspective Key Event Regex New Line