My mistake, the examples should have been double-brackets. I’ll correct that.
Termination of regex would work the way it works now: /regex/
Therefore forward-slash would be escaped, as it is now. There is no problem with unpaired (or paired) brackets in a regex because it’s in the context (grammar) of a regex, not outside the regex. Outside the regex, they would be escaped (as they would in a regex). So for example if you use backlinks to collect your recipes and ingredients, (notes containing [[recipe]] for example) and you want to embed links for all recipes containing kale, your search might be
[[query|\[\[recipe\]\] \[\[kale\]\]]]
And now you’ve got an auto-updating note that keeps a list of all kale recipes. Since the query is replaced by all matching notes as links, you’ll be able to hover over each one to see them, which I’d find very useful.
We don’t need to use a keyword like “query”. I suppose it could be anything that isn’t likely to be confused with a note name.