         @recompile()
 
   singleLineCommentRegex: ->
-    return @_singleLineCommentRegex if @_singleLineCommentRegex
+    if @_singleLineCommentRegex
+      @_singleLineCommentRegex.lastIndex = 0
+      return @_singleLineCommentRegex
     commentStarts =
       javascript: '//'
       python: '#'

      name: 'disable-spaces'
      bindKey: 'Space'
      exec: =>
        cursor = @ace.getCursorPosition()
          sentance = @aceDoc.getLine(cursor.row)
          
      commentStarts =
      javascript: '//'
      python: '#'
      coffeescript: '#'
      clojure: ';'
      lua: '--'
      io: '//'
    commentStart = commentStarts[@spell.language] or '//'
    if(flg=/#{commentStart}/.test sentance)
    @ace.execCommand 'insertstring', ' '
    else
    @ace.execCommand 'insertstring', ' ' unless LevelOptions[@options.level.get('slug')]?.disableSpaces
    
    addCommand
      name: 'throttle-backspaces'
      bindKey: 'Backspace'

      lua: '--'
      io: '//'
    commentStart = commentStarts[@spell.language] or '//'
    @_singleLineCommentRegex = new RegExp "[ \t]*#{commentStart}[^\"'\n]*", 'g'
    @_singleLineCommentRegex

  preload: ->
    # Send this code over to the God for preloading, but don't change the cast state.
