Skip to content

Commit

Permalink
simplified regex
Browse files Browse the repository at this point in the history
  • Loading branch information
sanderr committed Jul 26, 2023
1 parent 6663b89 commit 314d7c1
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion src/pip/_internal/req/constructors.py
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,10 @@ def _set_requirement_extras(req: Requirement, new_extras: Set[str]) -> Requireme
are given).
"""
match: Optional[re.Match[str]] = re.fullmatch(
r"([^;\[<>~=]+)(\[[^\]]*\])?(.*)", str(req)
# see https://peps.python.org/pep-0508/#complete-grammar
r"([\w\t .-]+)(\[[^\]]*\])?(.*)",
str(req),
flags=re.ASCII,
)
# ireq.req is a valid requirement so the regex should always match
assert match is not None
Expand Down

0 comments on commit 314d7c1

Please sign in to comment.