Updated the prompt regex to prevent a hang when defining functions