mirror of
https://github.com/python/cpython.git
synced 2025-11-25 12:44:13 +00:00
Improve pattern used for mbox 'From' lines; add a simple test
This commit is contained in:
parent
5a096e1b10
commit
b78bb74c41
2 changed files with 38 additions and 3 deletions
|
|
@ -1995,8 +1995,10 @@ class UnixMailbox(_Mailbox):
|
|||
# necessary. For convenience, we've added a PortableUnixMailbox class
|
||||
# which uses the more lenient _fromlinepattern regular expression.
|
||||
|
||||
_fromlinepattern = r"From \s*[^\s]+\s+\w\w\w\s+\w\w\w\s+\d?\d\s+" \
|
||||
r"\d?\d:\d\d(:\d\d)?(\s+[^\s]+)?\s+\d\d\d\d\s*$"
|
||||
_fromlinepattern = (r"From \s*[^\s]+\s+\w\w\w\s+\w\w\w\s+\d?\d\s+"
|
||||
r"\d?\d:\d\d(:\d\d)?(\s+[^\s]+)?\s+\d\d\d\d\s*"
|
||||
r"[^\s]*\s*"
|
||||
"$")
|
||||
_regexp = None
|
||||
|
||||
def _strict_isrealfromline(self, line):
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue