Allow empty match replace

back merge from 100333 from pywikibot/core.git

Change-Id: I99c2a97bc2963e6ae1f2cc26cedd5da8fb8bf5e0
Merge "Allow empty match replace"