jenkins-bot has submitted this change and it was merged.
Change subject: Allow empty match replace ......................................................................
Allow empty match replace
back merge from 100333 from pywikibot/core.git
Change-Id: I99c2a97bc2963e6ae1f2cc26cedd5da8fb8bf5e0 --- M pywikibot/textlib.py 1 file changed, 1 insertion(+), 1 deletion(-)
Approvals: Xqt: Looks good to me, approved jenkins-bot: Verified
diff --git a/pywikibot/textlib.py b/pywikibot/textlib.py index 30d78b6..bb6fb9a 100644 --- a/pywikibot/textlib.py +++ b/pywikibot/textlib.py @@ -224,7 +224,7 @@ int(groupMatch.group('number'))) try: replacement = (replacement[:groupMatch.start()] + - match.group(groupID) + \ + ('' if match.group(groupID) is None else match.group(groupID)) + \ replacement[groupMatch.end():]) except IndexError: pywikibot.output('\nInvalid group reference: %s' % groupID)