Maybe use ReformulateLocation to perform the location based substitution?
:D
In reply to Re^5: Search replace with a block by beech in thread Search replace with a block by santoshrao99