Skip to content

Commit

Permalink
Add 'url' named capture group to common.url Regex
Browse files Browse the repository at this point in the history
  • Loading branch information
ptmcg committed Mar 27, 2023
1 parent 24b0b29 commit 391fd80
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion pyparsing/common.py
Original file line number Diff line number Diff line change
Expand Up @@ -363,6 +363,7 @@ def strip_html_tags(s: str, l: int, tokens: ParseResults):
url = Regex(
# https://mathiasbynens.be/demo/url-regex
# https://gist.github.com/dperini/729294
r"(?P<url>" +
# protocol identifier (optional)
# short syntax // still required
r"(?:(?:(?P<scheme>https?|ftp):)?\/\/)" +
Expand Down Expand Up @@ -403,7 +404,8 @@ def strip_html_tags(s: str, l: int, tokens: ParseResults):
# query string (optional)
r"(\?(?P<query>[^#]*))?" +
# fragment (optional)
r"(#(?P<fragment>\S*))?"
r"(#(?P<fragment>\S*))?" +
r")"
).set_name("url")
"""URL (http/https/ftp scheme)"""
# fmt: on
Expand Down

0 comments on commit 391fd80

Please sign in to comment.