Fix a bug: replace-first-by (and thus replace-first) returns nil

when it should return the original text.

The bug occurs only when the second argument of replace-first is a pattern and the third argument is a function.