https://bugzilla.wikimedia.org/show_bug.cgi?id=55184

--- Comment #2 from Kunal Mehta (Legoktm) <[email protected]> ---
This regex here is just an example, and probably a bad one \(as the regex it
does nothing by this replacement\). Your suggestion regarding the specific
regex \(to use inner optional group within group\) would probably fix this
specific regex, but this is workaround - replace.py should support replacing
capturing optional capturing group the same way re.findall behaves.

The behaviour of replacing None to empty string is compatible with the
behaviour of re.findall \(re.findall\('a\(b\)?\(c\)','ac'\) =&gt; \[\('',
'c'\)\]\)  and with regex engines of most languages \(in JS:
'ac'.replace\(/a\(b\)?\(c\)/,'a$1c'\)\), though python re isn't consistent here
\(re.sub\('a\(b\)?\(c\)','X\\\1','ac'\) - is error\).

-- 
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

Reply via email to