Skip to content

Commit 314d7c1

Browse files
committed
simplified regex
1 parent 6663b89 commit 314d7c1

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

src/pip/_internal/req/constructors.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,10 @@ def _set_requirement_extras(req: Requirement, new_extras: Set[str]) -> Requireme
6565
are given).
6666
"""
6767
match: Optional[re.Match[str]] = re.fullmatch(
68-
r"([^;\[<>~=]+)(\[[^\]]*\])?(.*)", str(req)
68+
# see https://peps.python.org/pep-0508/#complete-grammar
69+
r"([\w\t .-]+)(\[[^\]]*\])?(.*)",
70+
str(req),
71+
flags=re.ASCII,
6972
)
7073
# ireq.req is a valid requirement so the regex should always match
7174
assert match is not None

0 commit comments

Comments
 (0)