[issue42871] Regex compilation crashed if I change order of alternatives under quantifier

2021-01-08 Thread Renji


New submission from Renji :

I can compile "((a)|b\2)*" expression and this expression successfully return 
captures from first repetition and second repetition in one time. But if I 
write (b\2|(a))* expression, I get "invalid group reference 2 at position 3" 
error. Either first or second behavior incorrect.
python3 --version Python 3.7.3

import re
text="aba"
#match=re.search(r"(b\2|(a))*",text) - not worked
match=re.search(r"((a)|b\2)*",text)
if(match):
#show aba ba a
print(match.group(0)+" "+match.group(1)+" "+match.group(2))

--
components: Regular Expressions
messages: 384703
nosy: Renji, ezio.melotti, mrabarnett
priority: normal
severity: normal
status: open
title: Regex compilation crashed if I change order of alternatives under 
quantifier
type: behavior
versions: Python 3.7

___
Python tracker 
<https://bugs.python.org/issue42871>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue42871] Regex compilation crashed if I change order of alternatives under quantifier

2021-01-08 Thread Renji


Renji  added the comment:

In my example reference and capture group presents in two difference 
alternatives. They don't follow each other, but executed in random order. If 
this don't supported in one case, why it supported in other case?

--

___
Python tracker 
<https://bugs.python.org/issue42871>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue42871] Regex compilation crashed if I change order of alternatives under quantifier

2021-01-08 Thread Renji


Renji  added the comment:

I through "forward reference" is "\1 (abcd)". Not "some sort of reference in 
second repetition to data from first repetition".

Ok. In other words refers from on repetition to other supported, but with 
purely formal restrictions. And remove this restrictions don't planned. Than 
this issue may be closed.

--

___
Python tracker 
<https://bugs.python.org/issue42871>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com