 
   findMatchingEndPair: (startPairPosition, startPair, endPair) ->
     scanRange = new Range(startPairPosition.translate([0, 1]), @editor.buffer.getEndPosition())
-    regex = new RegExp("[#{_.escapeRegExp(startPair + endPair)}]", 'g')
     endPairPosition = null
     unpairedCount = 0
-    @editor.scanInBufferRange regex, scanRange, ({match, range, stop}) ->
+    @editor.scanInBufferRange pairRegexes[startPair], scanRange, ({match, range, stop}) ->
       switch match[0]
         when startPair
           unpairedCount++

  ')': '('
  ']': '['
  '}': '{'

module.exports =
class BracketMatcherView extends View


  findMatchingStartPair: (endPairPosition, startPair, endPair) ->
    scanRange = new Range([0, 0], endPairPosition)
    startPairPosition = null
    unpairedCount = 0
    @editor.backwardsScanInBufferRange pairRegexes[startPair], scanRange, ({match, range, stop}) ->
      switch match[0]
        when startPair
          unpairedCount--
