There are various keyboard commands for editing text, and the Expression Editor has buttons for clearing and restoring the entire text of an expression.
If you close the Expression Editor window without successfully compiling an expression with the Create or Edit button, Maya discards any editing changes you’ve made.
Undoing back to an expression’s previous contents
The Edit button compiles an expression. If you’ve made an editing change and haven’t yet clicked the Edit button, you can click the Reload button to retrieve the previous expression. This restores the expression to the contents last present when you clicked the Create or Edit button.