export: Fix replacement of multiple TARGET_NAME expressions
After replacing each such expression, search for following expressions immediately after the end of the replacement text, not after the position of the end of the replaced text.
Fixes: #21661 (closed)