(?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`!()\[\]{};:'".,<>?«»“”‘’]))
Hold on, let me draw up the NFA
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
As visualized by Regex Vis [1]

check out Regulex! it doesn’t support mode modifiers but
it does lack some features but i really like how its graphs lookNice. Is there terminal/native running software with something similar?
Other than just running the HTML+JS/TS project in a container.
No
:(
That’s John Gruber’s regex pattern for matching URL’s (⌐■_■).
truly a sunglasses moment indeed
Whatever this is supposed to match, I bet the bycatch is bigger than tuna fishing.
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
/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.
What. The. Fuck.
This is an example of the old adage that “When you use a regex to solve a problem, you end up with two problems.”
Probably documents from HP’s atrocious support site
URLs in an HTML document that aren’t namespaces or otherwise enclosed?
Is it a rick roll?
Looks like the hacking mini game in Fallout 4.









