Allow replace pattern with empty string,
expression if (opts.replace) is false for empty string

Add test

fix the indentation