Refactor perl regex find/replace to $PSED