Improvements for replace.py
Improvements for replace.py

Detached from I600816e5a297427159c5bbedad988c0dfd823868

Change-Id: I3b76731f8990e91c0d1132d583be9d8b162f3a3c
Signed-off-by: xqt <59bd0a3ff43b32849b319e645d4798d8a5d1e889@gno.de>

wikimedia/pywikibot-core,wikimedia/pywikibot-core,PersianWikipedia/pywikibot-core