function getRegexForBrackets(brackets) {
    let pieces = [];
    for (const bracket of brackets) {
        for (const open of bracket.open) {
            pieces.push(open);
        }
        for (const close of bracket.close) {
            pieces.push(close);
        }
    }
    pieces = unique(pieces);
    return createBracketOrRegExp(pieces);
}
Creates a regular expression that targets all bracket pairs.

e.g. for the bracket pairs:
 ['{','}']
 ['begin,'end']
 ['for','end']
the regex would look like:
 /(\{)|(\})|(\bbegin\b)|(\bend\b)|(\bfor\b)/