       endBufferPosition = [position.row, position.column + index + 1]
       range = [[position.row, position.column], [endBufferPosition[0], endBufferPosition[1]]]
       currentText = editor.getTextInBufferRange(range)
-      if regex.test(currentText) || endBufferPosition[1] == 500 || currentText == previousText
+      if forwardRegex.test(currentText) || endBufferPosition[1] == 500 || currentText == previousText
           foundEnd = true
       previousText = editor.getTextInBufferRange(range)
       break if foundEnd

    foundEnd = false
    startBufferPosition = []
    endBufferPosition = []
    regex = /\(|\s|\)|;|'|,|"|\|/
    index = -1
    previousText = ''


      startBufferPosition = [position.row, position.column - index - 1]
      range = [[position.row, position.column], [startBufferPosition[0], startBufferPosition[1]]]
      currentText = editor.getTextInBufferRange(range)
      if backwardRegex.test(editor.getTextInBufferRange(range)) || startBufferPosition[1] == -1 || currentText == previousText
          foundStart = true
      previousText = editor.getTextInBufferRange(range)
      break if foundStart
