New submission from Rondevous <rondevu.mis...@protonmail.com>:
Can it please be hinted in the docs of re.findall to use (?:...) for non-capturing groups? >>> re.findall('(foo)?bar|cool', 'cool') [''] >>> ### I expected the result: ['cool'] After hours of frustration, I learnt that I should use a non-capturing group (?:foo) in the pattern. This was not obvious. P.S. Making the groups non-capturing in such a pattern is not needed in javascript (as tested on regexr.com); could this be an issue with the | operator in re.findall? ---------- assignee: docs@python components: Documentation messages: 399799 nosy: docs@python, rondevous priority: normal severity: normal status: open title: Hint the use of non-capturing group in re.findall() documentation type: enhancement versions: Python 3.8 _______________________________________ Python tracker <rep...@bugs.python.org> <https://bugs.python.org/issue44940> _______________________________________ _______________________________________________ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com