Changed replacement order to make %textp work.