       [this]
 
   resolveScopeName: (line, captureIndices) ->
-    resolvedScopeName = @scopeName.replace /\${(\d+):\/(downcase|upcase)}/, (match, index, command) ->
+    resolvedScopeName = @scopeName.replace CustomCaptureIndexRegex, (match, index, command) ->
       capture = captureIndices[parseInt(index)]
       if capture?
         replacement = line.substring(capture.start, capture.end)

_ = require 'underscore-plus'

module.exports =
class Pattern

    @scopeName = name ? contentName # TODO: We need special treatment of contentName

    if match
      if (end or @popRule) and @hasBackReferences ?= DigitRegex.test(match)
        @match = match
      else
        @regexSource = match
