improve keyword and anonymous input for replace (and %)
Merge pull request #2309 from seven-phases-max/more-input-types-for-replace

Improve keyword and anonymous input for replace function (fixes #2308).