[issue23692] Undocumented feature prevents re module from finding certain matches

2019-11-12 Thread Jackson Riley
Jackson Riley added the comment: Hi Matthew, Serhiy, I tried to identify the right places in re to fix things but have found it a bit difficult. I wrote up my attempt (at https://enhackathon.github.io/2019/11/04/JacksonRiley.html) which includes some examples that behave differently from

[issue23692] Undocumented feature prevents re module from finding certain matches

2019-11-04 Thread Matthew Barnett
Matthew Barnett added the comment: It's been many years since I looked at the code, and there have been changes since then, so some of the details might not be correct. As to have it should behave: re.match('(?:()|(?(1)()|z)){1,2}(?(2)a|z)', 'a') Iteration 1. Match the repeated part. Group

[issue23692] Undocumented feature prevents re module from finding certain matches

2019-11-04 Thread Jackson Riley
Jackson Riley added the comment: I've got a bit confused and am doubting myself - is the below output expected? >>> m = re.match('(?:()|(?(1)()|z)){1,2}(?(2)a|z)', 'a') >>> m.groups() ('', '') >>> m = re.match('(?:()|(?(1)()|z)){1,2}(?(1)a|z)', 'a') >>> m.groups() ('', None) The first pattern

[issue23692] Undocumented feature prevents re module from finding certain matches

2019-11-04 Thread Jackson Riley
Jackson Riley added the comment: Ah thank you very much Serhiy, that's super helpful! -- ___ Python tracker ___ ___

[issue23692] Undocumented feature prevents re module from finding certain matches

2019-11-04 Thread Serhiy Storchaka
Serhiy Storchaka added the comment: Matthew referred to the code of the regex module (of which he is the author). https://pypi.org/project/regex/ -- ___ Python tracker ___

[issue23692] Undocumented feature prevents re module from finding certain matches

2019-11-04 Thread Jackson Riley
Jackson Riley added the comment: Hi Matthew, thank you for your suggestions of where to start. Could you possibly give a pointer to the place in the code where the 'capture changed' counter is incremented? I had a bit of a hunt and couldn't find it but may have been looking in the wrong

[issue23692] Undocumented feature prevents re module from finding certain matches

2019-10-29 Thread Lewis Gaul
Lewis Gaul added the comment: Thanks for the explanation Matthew, I'll take a further look at some point in the coming weeks. -- ___ Python tracker ___

[issue23692] Undocumented feature prevents re module from finding certain matches

2019-10-27 Thread Ma Lin
Change by Ma Lin : -- nosy: +Ma Lin ___ Python tracker ___ ___ Python-bugs-list mailing list Unsubscribe:

[issue23692] Undocumented feature prevents re module from finding certain matches

2019-10-27 Thread Matthew Barnett
Matthew Barnett added the comment: Suppose you had a pattern: .* It would advance one character on each iteration of the * until the . failed to match. The text is finite, so it would stop matching eventually. Now suppose you had a pattern: (?:)* On each iteration of the * it

[issue23692] Undocumented feature prevents re module from finding certain matches

2019-10-27 Thread Lewis Gaul
Lewis Gaul added the comment: Hi there, if anyone's able to provide any guidance on this issue I'd be happy to take a look into it. Is this a behaviour that is feasible to fix, or should this just be documented in some way as suggested by Evgeny? -- nosy: +Lewis Gaul

[issue23692] Undocumented feature prevents re module from finding certain matches

2016-10-16 Thread Serhiy Storchaka
Changes by Serhiy Storchaka : -- nosy: +serhiy.storchaka stage: -> needs patch versions: +Python 2.7, Python 3.5, Python 3.6, Python 3.7 -Python 3.4 ___ Python tracker

[issue23692] Undocumented feature prevents re module from finding certain matches

2015-03-17 Thread Evgeny Kapun
New submission from Evgeny Kapun: This pattern matches: re.match('(?:()|(?(1)()|z)){2}(?(2)a|z)', 'a') But this doesn't: re.match('(?:()|(?(1)()|z)){0,2}(?(2)a|z)', 'a') The difference is that {2} is replaced by {0,2}. This shouldn't prevent the pattern from matching anywhere where