4 ms·
If they use a regex? https://linkedin.com@i-dont-have-linkedin.com?linkedin.com/ https://linkedin.com@i-dont-have-linkedin.com?linkedin.com/ If they do it the
by sebstefan 2y ago
If they use a regex? https://linkedin.com@i-dont-have-linkedin.com?linkedin.com/ https://linkedin.com@i-dont-have-linkedin.com?linkedin.com/
If they do it the proper way? It's all ogre
You shouldn't use regex to parse URLs, you should use the URL handler that comes with your language (ex: https://developer.mozilla.org/en-US/docs/Web/API/URL/URL https://developer.mozilla.org/en-US/docs/Web/API/URL/URL)
```js
const linkedin = new URL("https://linkedin.com@i-dont-have-linkedin.com?linkedin.com/");
console.log(linkedin.host);
// => "i-dont-have-linkedin.com"
```
- xdennis 2y agoNeat trick. Firefox does give a warning about it: > You are about to log in to the site “i-dont-have-linkedin.com” with the username “linkedin.com”, but the web site does not require authentication. This may be an attempt to trick you. > Is “i-dont-have-linkedin.com” the site you want to visit? If those sites are even more clever than a regex, they might bin your application for this.
- sebstefan 2y agoWhat kind of HR writes scripts to check for weird URLs in people's links They're orders of magnitude more likely to bin your application for a thousand arbitrary reasons than to have specifically implemented something that weird You shouldn't live your life around things that will likely never happen