   updateRailRoadDiagram: () =>
     editor = atom.workspace.getActiveEditor()
     return if not editor?
-    range = editor.bufferRangeForScopeAtCursor("string.regexp")
+
+    # python uses raw-regex (must be before other, because python grammar
+    # also uses regexp for char classes)
+    range = editor.bufferRangeForScopeAtCursor(".raw-regex")
+
+    unless range
+      # usually somewhere there is .regexp in scope name
+      range = editor.bufferRangeForScopeAtCursor(".regexp")
+
     #console.log "cursor moved", range
     if not range
       if @isVisible

      text = editor.getTextInBufferRange(range)
      #console.log text
      text = text.replace(/^\s+/, "").replace(/\s+$/, "")
      #if te
      m = /^\/\/\/(.*)\/\/\/\w*$/.exec(text)
      if m?

        m = /^\/(.*)\/\w*$/.exec(text)
        if m?
          text = m[1]

      if not @isVisible or @currentRegex != text
        @.find('div.error-message').remove()
