Does anyone know if a perfect regex URL validator exists? There's one in the article I posted that passed all but one test, which makes me wonder if it's even possible.
You didn't even specify what type of regex. Since it's possible to have a url that validates but doesn't exist or is otherwise unreachable, I'm at a loss for why anyone would care unless you run a registrar.
A normal person would validate that it doesn't overflow or otherwise break their code.
A shitty programmer would sperg out about how to make a single perfect line that still fails anyway, and not even realize not every regular expression feature works the same or is supported in every implementation of regular expressions.
Seriously man, you fucking lost and now you're trying to save face, and you're doing so doubling down on your retardedness. How stupid can you get? Just take the L and go home, you don't know what you're talking about.
To clarify, I’m looking for a decent regular expression to validate URLs that were entered as user input with.I also don’t want to allow every possible technically valid URL — quite the opposite.
14 comments
0 u/user9713 [OP] 04 Nov 2019 06:24
Does anyone know if a perfect regex URL validator exists? There's one in the article I posted that passed all but one test, which makes me wonder if it's even possible.
0 u/Element115 04 Nov 2019 13:32
Valid characters in DNS request specification. That's it.
If you want to define a DNS response for "server" then "server" is now a valid URL.
0 u/user9713 [OP] 04 Nov 2019 14:51
The regex part is what I'm interested in. As you can see from the link (or do a search), it's tough to find a 100% failproof regex pattern.
0 u/Element115 05 Nov 2019 03:14
You didn't even specify what type of regex. Since it's possible to have a url that validates but doesn't exist or is otherwise unreachable, I'm at a loss for why anyone would care unless you run a registrar.
0 u/user9713 [OP] 05 Nov 2019 03:27
lol why validate user input at all? Unless you run a registrar.
0 u/Element115 05 Nov 2019 03:38
A normal person would validate that it doesn't overflow or otherwise break their code.
A shitty programmer would sperg out about how to make a single perfect line that still fails anyway, and not even realize not every regular expression feature works the same or is supported in every implementation of regular expressions.
0 u/user9713 [OP] 05 Nov 2019 03:48
wHy Do YoU eVeN nEeD tO VaLiDaTe?
0 u/Element115 05 Nov 2019 03:52
Actually I'd like to see you offer a reason that isn't nullified by "not all possible DNS entries exist".
You don't get to use overflows or other escapes as an excuse, I already mentioned those.
0 u/user9713 [OP] 05 Nov 2019 03:50
Seriously man, you fucking lost and now you're trying to save face, and you're doing so doubling down on your retardedness. How stupid can you get? Just take the L and go home, you don't know what you're talking about.
0 u/Element115 05 Nov 2019 03:58
You didn't realize "regular expression" and even "PCRE" means something slightly different in almost every language until just now did you?
0 u/user9713 [OP] 05 Nov 2019 03:59
Oh no, you're retarded.
Go back to building "Hello World"s.
0 u/Element115 05 Nov 2019 04:21
Says the guy who made no attempt at his own problem and couldn't even contrive a case where it would matter.
No less than I'd expect from a web developer. Don't you have to go import another 400 libraries so you can copy/paste one more function or something?
0 u/cT9NlRLhxlyr 04 Nov 2019 07:47
WTF is this idiot even saying?
0 u/user9713 [OP] 04 Nov 2019 14:44
LOL I read that and didn't understand it, either.