update string replacement with dictionary lookup