Skip to content

Commit

Permalink
Fix EVR regex to not match email addresses with - in them
Browse files Browse the repository at this point in the history
  • Loading branch information
dcermak committed Jan 6, 2025
1 parent c0a98a8 commit 55039df
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 6 deletions.
12 changes: 6 additions & 6 deletions specfile/changelog.py
Original file line number Diff line number Diff line change
Expand Up @@ -88,12 +88,12 @@ def evr(self) -> Optional[str]:
m = re.match(
r"""
^.*
\s+ # preceding whitespace
((?P<sb>\[)|(?P<rb>\())? # optional opening bracket
(?P<evr>(\d+:)?\S+-\S+?) # EVR
(?(sb)\]|(?(rb)\))) # matching closing bracket
:? # optional colon
\s* # optional following whitespace
\s+ # preceding whitespace
((?P<sb>\[)|(?P<rb>\())? # optional opening bracket
(?P<evr>(\d+:)?(\d+\.)\S*-\S+?) # EVR
(?(sb)\]|(?(rb)\))) # matching closing bracket
:? # optional colon
\s* # optional following whitespace
$
""",
self.header,
Expand Down
1 change: 1 addition & 0 deletions tests/unit/test_changelog.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
"header, evr",
[
("* Thu Jan 04 2007 Michael Schwendt <[email protected]>", None),
("* Thu Jan 04 2007 Michael Schwendt <[email protected]>", None),
(
"* Mon Jul 13 2020 Tom Stellard <[email protected]> 4.0-0.4.pre2",
"4.0-0.4.pre2",
Expand Down

0 comments on commit 55039df

Please sign in to comment.