Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Mention just how loose this component is #4

Open
dandv opened this issue Feb 21, 2014 · 6 comments
Open

Mention just how loose this component is #4

dandv opened this issue Feb 21, 2014 · 6 comments

Comments

@dandv
Copy link

dandv commented Feb 21, 2014

var matcher = /^\w+:\/\/([^\s\.]+\.\S{2}|localhost[\:?\d]*)\S*$/;

Will fail SO badly in so many cases: IDNs, modern TLDs, parens in URLs, punctuation at the end etc.

There's a much more powerful regexp in component/regexps.uri.

I understand this component doesn't really aim to properly parse URLs like linkify, but perhaps it's better to just use the regexps component.

@ianstormtaylor
Copy link
Contributor

can you give some examples? and do you have a fix for the IDNs? open to PRs

i think parens are valid in urls?

if anything, component/regexps is going to fail on new TLDs, it already fails on localhost, rare protocols, etc...

@dandv
Copy link
Author

dandv commented Feb 21, 2014

I think I found a library that's better than Component, maybe we can focus our efforts on improving that one - http://soapbox.github.io/jQuery-linkify/. A simple regexp just won't cut it.

@kevva
Copy link

kevva commented Nov 22, 2014

#9 will fix most of these issues.

@dandv
Copy link
Author

dandv commented Nov 23, 2014

Whether #9 will fix those issues I don't know. My point is, why develop yet another "is this string a URL" library when there are so many out there, and better at that to boot.

@davisjam
Copy link
Contributor

davisjam commented Mar 20, 2018

Why develop yet another "is this string a URL" library

Perhaps this observation is too late now. This module gets 2M downloads/month on npm.

  1. Worth closing this issue?
  2. Test cases with valid but rejected URLs welcome.

@dandv
Copy link
Author

dandv commented May 28, 2020

Looks like validator has more traction. Too bad there's no TypeScript support.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants