Message308278
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 |
|
Date |
User |
Action |
Args |
2017-12-14 07:56:47 | danielhrisca | set | recipients:
+ danielhrisca |
2017-12-14 07:56:47 | danielhrisca | set | messageid: <1513238207.94.0.213398074469.issue32319@psf.upfronthosting.co.za> |
2017-12-14 07:56:47 | danielhrisca | link | issue32319 messages |
2017-12-14 07:56:47 | danielhrisca | create | |
|