Код:
import re
r = re.search("?:((xxxx)|(yyyy)|(zzzz))+", "x = y + z")
Сообщение об ошибке:
D:/FILE_MGMT_PYTHON/ghqer4tqaery.py
Traceback (most recent call last):
File "D:/FILE_MGMT_PYTHON/ghqer4tqaery.py", line 4, in <module>
r = re.search("?:((xxxx)|(yyyy)|(zzzz))+", "x = y + z")
File "C:\Users\Sam\AppData\Local\Programs\Python\Python38-32\lib\re.py", line 199, in search
return _compile(pattern, flags).search(string)
File "C:\Users\Sam\AppData\Local\Programs\Python\Python38-32\lib\re.py", line 302, in _compile
p = sre_compile.compile(pattern, flags)
File "C:\Users\Sam\AppData\Local\Programs\Python\Python38-32\lib\sre_compile.py", line 764, in compile
p = sre_parse.parse(p, flags)
File "C:\Users\Sam\AppData\Local\Programs\Python\Python38-32\lib\sre_parse.py", line 948, in parse
p = _parse_sub(source, state, flags & SRE_FLAG_VERBOSE, 0)
File "C:\Users\Sam\AppData\Local\Programs\Python\Python38-32\lib\sre_parse.py", line 443, in _parse_sub
itemsappend(_parse(source, state, verbose, nested + 1,
File "C:\Users\Sam\AppData\Local\Programs\Python\Python38-32\lib\sre_parse.py", line 668, in _parse
raise source.error("nothing to repeat",
re.error: nothing to repeat at position 0
Process finished with exit code 1