(?i)\b((?:(?:[a-z][\w-]+:)?(?:/{1,3}|[a-z0-9%])|www\d{0,3}[.]|[a-z0-9.\-]+[.][a-z]{2,4}/)(?:[^\s()<>]+|\(([^\s()<>]+|(\([^\s()<>]+\)))*\))+(?:\(([^\s()<>]+|(\([^\s()<>]+\)))*\)|[^\s`!()\[\]{};:'".,<>?«»“”‘’]))
Looks like the hacking mini game in Fallout 4.
Is it a rick roll?
URLs in an HTML document that aren’t namespaces or otherwise enclosed?
Probably documents from HP’s atrocious support site
This is an example of the old adage that “When you use a regex to solve a problem, you end up with two problems.”
Looks like an URL matcher of some sorts, that isn’t limited to HTTP. Kudos for handling parentheses as valid URL characters.
URLs can have newlines too
What. The. Fuck.
/unlearn
It seems most browsers basically ignore them:
https://lemire.me/blog/2026/02/28/you-can-use-newline-characters-in-urls/
So probably not worth remembering anyway.
Whatever this is supposed to match, I bet the bycatch is bigger than tuna fishing.
:(
That’s John Gruber’s regex pattern for matching URL’s (⌐■_■).
truly a sunglasses moment indeed
Hold on, let me draw up the NFA
As visualized by Regex Vis [1]

Nice. Is there terminal/native running software with something similar?
Other than just running the HTML+JS/TS project in a container.check out Regulex! it doesn’t support mode modifiers but
it does lack some features but i really like how its graphs look
At first glance IP address or URL, embedded in HTML, whatever it is, it’s a doozy. I wonder what the performance of it is like.
It works out as
O(regex^n)At least 2
No









