Regular Expressions 101

Community Patterns

Split URL

0

Regular Expression
Python

r"
((?#1)((?#2:protocol)\w+)://)((?#3:hostname)[\w\.]+)((?#4:path).+|$)
"
gm

Description

source = "https://regex101.com/r/Y5b7zZ/3"
result = ("https", "regex101.com", "/r/Y5b7zZ/3")
Submitted by saparapat - a year ago