replacePatternWithMatch() uses sed instead of grep.