For a templating engine, I am using regular expressions to identify content under brackets in a string. For example the regex needs to match {key} or or [element
you could use alternatives using pipe character (|) like this one /\[([\s\S]+?)\]|\{([\s\S]+?)\}|<([\s\S]+?)>/, although it gets pretty long.
|
/\[([\s\S]+?)\]|\{([\s\S]+?)\}|<([\s\S]+?)>/
EDIT: shortend the regex, is not that long any more...