   'macro-global-escaped':
     patterns: [
       {
-        begin: '(\\\\\\$)(\\\\\\{)?'
+        begin: '\\\\\\$\\{'
         beginCaptures:
           0: name: 'punctuation.definition.string.begin.stata'
-        end: '(\\\\\\})|(?=\\"|\\s|\\n|/|,)'
-        endCaptures:
-          1: name: 'punctuation.definition.string.end.stata'
+        end: '\\}'
+        endCaptures:
+          0: name: 'punctuation.definition.string.end.stata'
         patterns: [
           {include: '#macro-local'}
           {include: '#macro-global'}

          }
        ]
      }
    ]
  'macro-global':
    patterns: [
      {
        begin: '(\\$)(\\{)'
        beginCaptures:
          0: name: 'punctuation.definition.string.begin.stata'
        end: '\\}'

        ]
      }
      {
        begin: '\\$(?=[\\w&&[^0-9]])'
        beginCaptures:
          0: name: 'punctuation.definition.string.begin.stata'
        end: '(?!\\w)'
        patterns: [
          {include: '#macro-local'}
          {include: '#macro-global'}
