[issue30004] in regex-howto, improve example on grouping
Cristian Barbarosie <cristian.barbaro...@gmail.com> added the comment: I'm sorry, I have no experience at all with Git. Could you please do it for me ? The bug appears in two places, see my first two messages. Thank you -- ___ Python tracker <rep...@bugs.python.org> <https://bugs.python.org/issue30004> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue30004] in regex-howto, improve example on grouping
Cristian Barbarosie added the comment: This topic seems stuck. Is there anything else I should do ? -- ___ Python tracker <rep...@bugs.python.org> <http://bugs.python.org/issue30004> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue30004] in regex-howto, improve example on grouping
Cristian Barbarosie added the comment: Just discovered that a nearly identical example is presented in the end of section "Non-capturing and Named Groups". My proposal applies to this other example, too. And, by the way, reading this HOWTO has been very useful to me. -- ___ Python tracker <rep...@bugs.python.org> <http://bugs.python.org/issue30004> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue30004] in regex-howto, improve example on grouping
New submission from Cristian Barbarosie: In the Regular Expression HOWTO https://docs.python.org/3.6/howto/regex.html#regex-howto the last example in the "Grouping" section has a bug. The code is supposed to find repeated words, but it catches false repetitions. >>> p = re.compile(r'(\b\w+)\s+\1') >>> p.search('Paris in the the spring').group() 'the the' >>> p.search('k is the thermal coefficient').group() 'the the' I propose adding a \b after \1, this solves the problem : >>> p = re.compile(r'(\b\w+)\s+\1\b') >>> p.search('Paris in the the spring').group() 'the the' >>> print p.search('k is the thermal coefficient') None -- assignee: docs@python components: Documentation messages: 291209 nosy: Cristian Barbarosie, docs@python priority: normal severity: normal status: open title: in regex-howto, improve example on grouping type: enhancement versions: Python 2.7, Python 3.3, Python 3.4, Python 3.5, Python 3.6, Python 3.7 ___ Python tracker <rep...@bugs.python.org> <http://bugs.python.org/issue30004> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com