diff options
author | Konstantin Ryabitsev <konstantin@linuxfoundation.org> | 2020-02-20 17:15:54 -0500 |
---|---|---|
committer | Konstantin Ryabitsev <konstantin@linuxfoundation.org> | 2020-02-20 17:15:54 -0500 |
commit | 43d52c9d6d8ce4699f4457733f3dd6f29b1515e8 (patch) | |
tree | b1ac88bb5a5bac16c23535b6a49c4eb1c6c14a35 | |
parent | 54fc46db01c66eaa85bd7f16a658cd15006936dc (diff) | |
download | korg-helpers-43d52c9d6d8ce4699f4457733f3dd6f29b1515e8.tar.gz |
Be better matching whitespace in multiline regex
When we need to do multiline regexes, make sure we don't match
linebreaks when we mean for a regex to only match a single line.
Signed-off-by: Konstantin Ryabitsev <konstantin@linuxfoundation.org>
-rwxr-xr-x | get-lore-mbox.py | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/get-lore-mbox.py b/get-lore-mbox.py index 4a077a5..2c12dbd 100755 --- a/get-lore-mbox.py +++ b/get-lore-mbox.py @@ -30,7 +30,7 @@ charset.add_charset('utf-8', None) emlpolicy = email.policy.EmailPolicy(utf8=True, cte_type='8bit', max_line_length=None) logger = logging.getLogger('get-lore-mbox') -VERSION = '0.2.5' +VERSION = '0.2.6' # You can use bash-style globbing here WANTHDRS = [ @@ -376,7 +376,7 @@ class LoreMessage: if re.search(r'^---.*\n\+\+\+', payload, re.MULTILINE): self.body = payload - if re.search(r'^\s*\d+\sfile.*\d+ insertion.*\d+ deletion', self.body, re.MULTILINE | re.IGNORECASE): + if re.search(r'^\s*\d+ file.*\d+ insertion.*\d+ deletion', self.body, re.MULTILINE | re.IGNORECASE): self.has_diffstat = True if re.search(r'^---.*\n\+\+\+', self.body, re.MULTILINE): self.has_diff = True @@ -384,7 +384,7 @@ class LoreMessage: # We only pay attention to trailers that are sent in reply if self.reply: # Do we have something that looks like a person-trailer? - matches = re.findall(r'^\s*([\w-]+):\s+(.*<\S+>)\s*$', self.body, re.MULTILINE) + matches = re.findall(r'^\s*([\w-]+):[ \t]+(.*<\S+>)\s*$', self.body, re.MULTILINE) if matches: # Does the email in the trailer match what's in the From? for tname, tvalue in matches: |