This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author vmd3.14
Recipients vmd3.14
Date 2022-03-07.13:19:26
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1646659166.96.0.869118025108.issue46945@roundup.psfhosted.org>
In-reply-to
Content
Here are the steps that I went through to test my regular expressions in my command prompt (a file attachment shows this as well). I am using Windows 11, version 21H2:

>>> import re
>>> regex = r"(((\w)+\w*\3){2}|(\w)+(?=\w*\4)\w*(?!\4)(\w)\w*\5)\w*"
>>> testString = "Alabama and Mississippi are next to each other"
>>> re.findall(regex,testString,re.IGNORECASE)
[('Mississipp', 'ipp', 'p', '', '')]
>>> testString = "alabama and Mississippi are next to each other"
>>> re.findall(regex,testString,re.IGNORECASE)
[('Mississipp', 'ipp', 'p', '', '')]
>>> regex = r"((\w)+\w*\2(\w)+\w*\3|(\w)+(?=\w*\4)\w*(?!\4)(\w)\w*\5)\w*"
>>> re.findall(regex,testString,re.IGNORECASE)
[('alabama', 'a', 'a', '', ''), ('Mississipp', 's', 'p', '', '')]
>>> testString = "Alabama and Mississippi are next to each other"
>>> re.findall(regex,testString,re.IGNORECASE)
[('Alabama', 'A', 'a', '', ''), ('Mississipp', 's', 'p', '', '')]

I created a regular expression to match any words with two sets of the same vowel, including words with four of the same vowel, ignoring case. My first regular expression “(((\w)+\w*\3){2}|(\w)+(?=\w*\4)\w*(?!\4)(\w)\w*\5)\w*" was able to match “Mississippi” but unable to match “Alabama” as it should have. To make sure that this error wasn’t somehow caused by a case sensitivity issue, I retested the regex with “alabama” instead of “Alabama”, but still I got no match on “alabama”. Then I tried replacing the quantifier {2} with just expression that was supposed to be repeated. This gave me the regex: "((\w)+\w*\2(\w)+\w*\3|(\w)+(?=\w*\4)\w*(?!\4)(\w)\w*\5)\w*". For some reason, this was able to match on both “alabama” and “Alabama” now, as shown above, and continued to match on Mississippi like expected. However, this result seems to contradict my understand of regular expressions because all I did to get these different results was copy the expression that was supposed to be executed twice by the quantifier.
History
Date User Action Args
2022-03-07 13:19:26vmd3.14setrecipients: + vmd3.14
2022-03-07 13:19:26vmd3.14setmessageid: <1646659166.96.0.869118025108.issue46945@roundup.psfhosted.org>
2022-03-07 13:19:26vmd3.14linkissue46945 messages
2022-03-07 13:19:26vmd3.14create