Minor nit here but would you mind changing this variable name to either `endPairRegex` or `endPairRegExp`, and also the similar variables in this function.