BUG/API: remove infer_types from replace and fix compiled regex bug

closes #3907.