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 danielhrisca
Recipients danielhrisca
Date 2017-12-14.07:56:47
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1513238207.94.0.213398074469.issue32319@psf.upfronthosting.co.za>
In-reply-to
Content
Consider this code snippet:


from re import match, fullmatch

pattern = '".+?"'
string = '"hello" "again"'

print(match(pattern, string))
print(fullmatch(pattern, string))


Which prints:
<_sre.SRE_Match object; span=(0, 7), match='"hello"'>
<_sre.SRE_Match object; span=(0, 15), match='"hello" "again"'>

The fullmatch function seems to ignore the non-greedy modifier.

From the fullmatch docstring I expected that fullmatch is equivalent to:

def fullmatch(pattern, string):
    match = re.match(pattern, string)
    if match:
        if match.start() == 0 and match.end() == len(string):
            return match
        else:
            return None
    else:
        return None
History
Date User Action Args
2017-12-14 07:56:47danielhriscasetrecipients: + danielhrisca
2017-12-14 07:56:47danielhriscasetmessageid: <1513238207.94.0.213398074469.issue32319@psf.upfronthosting.co.za>
2017-12-14 07:56:47danielhriscalinkissue32319 messages
2017-12-14 07:56:47danielhriscacreate