3 ms·
2 minutes reading an rfc about uris and I find a regex literally used in the specs: https://www.rfc-editor.org/rfc/rfc3986#page-7 https://www.rfc-editor.org/rf
by TZubiri 2y ago
2 minutes reading an rfc about uris and I find a regex literally used in the specs:
https://www.rfc-editor.org/rfc/rfc3986#page-7 https://www.rfc-editor.org/rfc/rfc3986#page-7
>> The following line is the regular expression for breaking-down a
well-formed URI reference into its components.
>> ^(([^:/?#]+):)?(//([^/?#]))?([^?#])(\?([^#]))?(#(.))?
Did Chomsky die for nothing?
I guess there are reasons to do things efficiently when possible, but a million URLs is not it, the adage about the root of all evil comes to mind. A billion URLs per second and it's almost interesting, but not really.
- FroshKiller 2y agoThe spec provides an expression for "well-formed" URIs. Good luck with real-world input.
- switchbak 2y agoLast I heard Noam Chomsky was still alive, and a quick Google doesn’t contradict that. Or is this some kind of high brow joke that went over my head?
- throw16180339 2y agoI think they're joking about Chomsky's work with formal languages (https://en.wikipedia.org/wiki/Chomsky_hierarchy https://en.wikipedia.org/wiki/Chomsky_hierarchy).
- TZubiri 2y agohttps://www.cbc.ca/news/world/noam-chomsky-not-dead-1.7239373 https://www.cbc.ca/news/world/noam-chomsky-not-dead-1.723937... Damn. I got fake newsd. It was probably a close call. My commiseration email must have looked so silly.
- yagiznizipli 2y agoRFC 3986 is a lot simpler than WHATWG spec. You can literally write a zero copy 3986 parser whereas you can’t with WHATWG. (And Ada is still faster than 3986 parsers)
- runlevel1 2y agoThat doesn't normalize the URL nor does it handle relative URL joining logic. It also doesn't handle URLs like: `file:///foo.txt`