<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def get_word_under_cursor(self):
 """ Returns the document word under cursor. :return: Word under cursor. :rtype: QString """


        if not re.match(r"^\w+$", foundations.strings.to_string(self.get_previous_character())):
            return QString()

        cursor = self.textCursor()
        cursor.movePosition(QTextCursor.PreviousWord, QTextCursor.MoveAnchor)
        cursor.movePosition(QTextCursor.EndOfWord, QTextCursor.KeepAnchor)
        return cursor.selectedText()