Created
June 21, 2021 13:50
-
-
Save ultrafunkamsterdam/69467b5a725020d7fcfdd1d072b2dbff to your computer and use it in GitHub Desktop.
python regex url pattern that actually works
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import re | |
REGEX_URL = re.compile(r"(?i)\b((?:https?://|www\d{0,3}[.]|[a-z0-9.\-]+[.][a-z]{2,4}/)(?:[^\s()<>]+|\(([^\s()<>]+|(\([^\s()<>]+\)))*\))+(?:\(([^\s()<>]+|(\([^\s()<>]+\)))*\)|[^\s`!()\[\]{};:'\".,<>?«»“”‘’]))") |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment