Re:In search of the perfect URL validation regex (2010)
by maciejgryka on Saturday September 25, 2021 @03:09PM
(#28655444)
Using https://regex.help/, I got this beauty which passes all the ones, which should pass. Obviously some room for improvement ;) But it works!
I had to replace some words with shorter ones to squeeze under 1000 char limit and there's no way to provide negative examples right now. Something to fix!
[ Parent
| on HN ]
Re:In search of the perfect URL validation regex (2010)
by axiosgunnar on Saturday September 25, 2021 @03:32PM
(#28655622)
> ⌘\.ws
I guess this is the regex equivalent of overfitting :)
Re:In search of the perfect URL validation regex (2010)
by saghm on Saturday September 25, 2021 @03:34PM
(#28655636)
Yeah, not to mention "code.google.com" being right in there!
Re:In search of the perfect URL validation regex (2010)
by maciejgryka on Saturday September 25, 2021 @03:40PM
(#28655667)
Yeah, grex (the library powering this) is really cool, but doesn’t generalize very well. I’m sure there are ways to improve it, but it’s not a trivial thing to do.