use regexp to replace path