[issue1519638] Unmatched Group issue - workaround

2014-10-10 Thread Serhiy Storchaka
Serhiy Storchaka added the comment: Thank you for your review Antoine. -- resolution: -> fixed stage: patch review -> resolved status: open -> closed ___ Python tracker ___ __

[issue1519638] Unmatched Group issue - workaround

2014-10-10 Thread Roundup Robot
Roundup Robot added the comment: New changeset bd2f1ea04025 by Serhiy Storchaka in branch 'default': Issue 1519638: Now unmatched groups are replaced with empty strings in re.sub() https://hg.python.org/cpython/rev/bd2f1ea04025 -- nosy: +python-dev __

[issue1519638] Unmatched Group issue - workaround

2014-10-10 Thread Serhiy Storchaka
Changes by Serhiy Storchaka : -- assignee: -> serhiy.storchaka ___ Python tracker ___ ___ Python-bugs-list mailing list Unsubscribe

[issue1519638] Unmatched Group issue - workaround

2014-10-08 Thread Antoine Pitrou
Changes by Antoine Pitrou : -- assignee: effbot -> ___ Python tracker ___ ___ Python-bugs-list mailing list Unsubscribe: https://m

[issue1519638] Unmatched Group issue - workaround

2014-09-18 Thread Serhiy Storchaka
Serhiy Storchaka added the comment: Here is a patch which make unmatched groups to be replaced by empty string. These changes looks rather as new feature than bug fix and therefore can be applied only to 3.5. -- components: +Library (Lib) keywords: +patch nosy: +serhiy.storchaka stage:

[issue1519638] Unmatched Group issue - workaround

2013-09-16 Thread irdb
Changes by irdb : -- nosy: +irdb ___ Python tracker ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mail

[issue1519638] Unmatched Group issue - workaround

2012-03-15 Thread Nikki DelRosso
Nikki DelRosso added the comment: Perfect; thank you! -- ___ Python tracker ___ ___ Python-bugs-list mailing list Unsubscribe: htt

[issue1519638] Unmatched Group issue - workaround

2012-03-15 Thread Matthew Barnett
Matthew Barnett added the comment: The replacement can be a callable, so you could do this: re.sub(r'(?:\((?:(\d+)|.*?)\)\s*)+$', lambda m: m.group(1) or '', 'avatar (special edition)') -- ___ Python tracker _

[issue1519638] Unmatched Group issue - workaround

2012-03-15 Thread Nikki DelRosso
Nikki DelRosso added the comment: Sorry, the non-working command should look as follows: re.sub(r'(?:\((?:(\d+)|.*?)\)\s*)+$','\\1','avatar (special edition)') -- ___ Python tracker

[issue1519638] Unmatched Group issue - workaround

2012-03-15 Thread Nikki DelRosso
Nikki DelRosso added the comment: I'm having the same issue as the original author of this issue was. The workaround does not apply to the situation where the captured text is on one side of an "or" grouping, rather than just being optional. I'm trying to remove groups of text in parenthese

[issue1519638] Unmatched Group issue - workaround

2010-06-25 Thread Ezio Melotti
Ezio Melotti added the comment: It would be nice if you could port 'pieces' of #2636 to Python, in order to fix this and other bugs (and possibly add more features too). -- nosy: +ezio.melotti ___ Python tracker

[issue1519638] Unmatched Group issue - workaround

2010-06-25 Thread Matthew Barnett
Matthew Barnett added the comment: Issue #2636 resulted in the new regex module (also available on PyPI), so this issue is addressed by that, but there's no patch for the re module. -- ___ Python tracker __

[issue1519638] Unmatched Group issue - workaround

2010-06-25 Thread Terry J. Reedy
Terry J. Reedy added the comment: If I understand "This has been addressed in issue #2636.", this issue should be closed as, perhaps, out-of-date or duplicate, with 2636 as superceder. Correct? -- nosy: +tjreedy versions: -Python 2.5, Python 3.0 __

[issue1519638] Unmatched Group issue - workaround

2009-02-09 Thread Gerard
Gerard added the comment: Matthew, Thanx for the heads-up! Regards, Gerard. ___ Python tracker ___ ___ Python-bugs-list mailing list Unsu

[issue1519638] Unmatched Group issue - workaround

2009-02-05 Thread Matthew Barnett
Matthew Barnett added the comment: This has been addressed in issue #2636. -- nosy: +mrabarnett ___ Python tracker ___ ___ Python-b

[issue1519638] Unmatched Group issue - workaround

2009-02-03 Thread Bobby Xiao
Bobby Xiao added the comment: It was so long ago, I've since redone half my codebase (the hack is still there, but I can't remember what it was meant to replace now :( ). Sorry about that. ___ Python tracker ___

[issue1519638] Unmatched Group issue - workaround

2009-02-03 Thread Gerard
Gerard added the comment: Bobby, Can you post the actual text you need this for? The back ref indeed returns a None. I'm wondering if the regex can be be simplefied and if a positive lookbehind could solve this. Symantically speaking ... If there's a "b" then return the "ar", because then an e

[issue1519638] Unmatched Group issue - workaround

2009-01-14 Thread Bobby Xiao
Bobby Xiao added the comment: Well, in this example the group (ar) is unmatched, so sre throws the error, and because of the alternation, the workaround you mentioned doesn't seem to directly apply. A better example is probably re.sub("foo(?:b(ar)|foo)","\\1","foofoo") because this can't be sim

[issue1519638] Unmatched Group issue - workaround

2009-01-13 Thread Gerard
Gerard added the comment: Dear Bobby, I don't see what would be the part that generates the empty string? Regards, Gerard. ___ Python tracker ___ ___

[issue1519638] Unmatched Group issue - workaround

2008-12-24 Thread Bobby Xiao
Bobby Xiao added the comment: How would I apply that workaround to my example? re.sub("foo(?:b(ar)|baz)","\\1","foobaz") ___ Python tracker ___ ___

[issue1519638] Unmatched Group issue - workaround

2008-09-27 Thread Jeffrey C. Jacobs
Changes by Jeffrey C. Jacobs <[EMAIL PROTECTED]>: -- versions: +Python 2.7 -Python 2.5 ___ Python tracker <[EMAIL PROTECTED]> ___ ___

[issue1519638] Unmatched Group issue - workaround

2008-09-27 Thread Jeffrey C. Jacobs
Changes by Jeffrey C. Jacobs <[EMAIL PROTECTED]>: -- nosy: +timehorse ___ Python tracker <[EMAIL PROTECTED]> ___ ___ Python-bugs-list

[issue1519638] Unmatched Group issue - workaround

2008-07-11 Thread Brandon Mintern
Brandon Mintern <[EMAIL PROTECTED]> added the comment: Looking at your code example, that solution seems quite obvious now, and I wouldn't even call it a "workaround". Thanks for figuring this out. Now if I could only remember what code I was using that for... ___

[issue1519638] Unmatched Group issue - workaround

2008-07-11 Thread Gerard
Gerard <[EMAIL PROTECTED]> added the comment: Hi All, I found a workaround for the re.sub method so it does not raise an exception but returns and empty string when backref-ing an empty group. This is the nutshell: When doing a search and replace with sub, replace the group represented as opti

[issue1519638] Unmatched Group issue

2007-12-16 Thread Brandon Mintern
Brandon Mintern added the comment: This is still a problem which has just given me a headache, because using re.sub now requires gymnastics instead of just using a simple string as I did in Perl. -- nosy: +BMintern _ Tracker <[EMAIL PROTECTED]>