in reply to Loop through global substitution

Perhaps with (?{ code })? Something like this:
1 while s/this(?{print"$&,$-[0]\n"})/that/;