Is this replacer function actually necessary? Even with absolute links, I don't ever seem to get into the case of match != from.

If it is necessary, here are a bunch of comments on it:
1) args p1, p2, offset, string not used.
2) Use === instead of == (== does type coersion).
3) Unecessary semi-colon on line 35.
4) No unit test coverage for line 33.