https://bugzilla.wikimedia.org/show_bug.cgi?id=55184
Web browser: ---
Bug ID: 55184
Summary: replace doesn't support optional groups
Product: Pywikibot
Version: unspecified
Hardware: All
OS: All
Status: NEW
Severity: normal
Priority: Unprioritized
Component: General
Assignee: [email protected]
Reporter: [email protected]
Classification: Unclassified
Mobile Platform: ---
Originally from: http://sourceforge.net/p/pywikipediabot/bugs/1484/
Reported by: Anonymous user
Created on: 2012-07-02 13:25:23
Subject: replace doesn't support optional groups
Original description:
textlib.py \(method replaceExcept\) doesn't support optional capturing groups
in regex.
I tried to run replace.py with the following regex: "RISHMI\(T |IM\)?" =>
"RISHMI\1"
when running it on a page containing the following text "SOMETHING RISHMI
SOMETHING"
it crashes with the following error:
textlib.py, line 178, in replaceExcept
match.group\(groupID\) + \
TypeError: coercing to Unicode: need string or buffer, NoneType found
line 178 contains the statement:
replacement = replacement\[:groupMatch.start\(\)\] + \
match.group\(groupID\) + \
replacement\[groupMatch.end\(\):\]
textlib.py should check for match.group\(groupID\) ==None and if so, add here
empty string instead of match.group\(groupID\)
--
You are receiving this mail because:
You are on the CC list for the bug.
_______________________________________________
Wikibugs-l mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/wikibugs-l