thejh / node-linkify

[ABANDONED]
MIT License
2 stars 3 forks source link

google.com is not identified #2

Open snatesan opened 12 years ago

snatesan commented 12 years ago

google.com or facebook.com etc are not identified.

thejh commented 12 years ago

I think that it would be very hard to do that in a generic way without too many false positives. Also, something like google.com/foo already works correctly.

How would you do it?

snatesan commented 12 years ago

It is difficult but is not complete with out that. For example it doen't find msdn.microsoft.com and other sites which doesn't start with www.

When I researched most of them includes check for the following match

'(?:aero|arpa|biz|com|coop|edu|gov|info|int|mil|museum|name|net|org|travel|ac|ad|ae|af|ag|ai|al|am|an|ao|aq|ar|as|at|au|aw|az|ba|bb|bd|be|bf|bg|bh|bi|bj|bm|bn|bo|br|bs|bt|bv|bw|by|bz|ca|cc|cd|cf|cg|ch|ci|ck|cl|cm|cn|co|cr|cu|cv|cx|cy|cz|de|dj|dk|dm|do|dz|ec|ee|eg|eh|er|es|et|fi|fj|fk|fm|fo|fr|ga|gd|ge|gf|gg|gh|gi|gl|gm|gn|gp|gq|gr|gs|gt|gu|gw|gy|hk|hm|hn|hr|ht|hu|id|ie|il|im|in|io|iq|ir|is|it|je|jm|jo|jp|ke|kg|kh|ki|km|kn|kp|kr|kw|ky|kz|la|lb|lc|li|lk|lr|ls|lt|lu|lv|ly|ma|mc|md|mg|mh|mk|ml|mm|mn|mo|mp|mq|mr|ms|mt|mu|mv|mw|mx|my|mz|na|nc|ne|nf|ng|ni|nl|no|np|nr|nu|nz|om|pa|pe|pf|pg|ph|pk|pl|pm|pn|pr|ps|pt|pw|py|qa|re|ro|ru|rw|sa|sb|sc|sd|se|sg|sh|si|sj|sk|sl|sm|sn|so|sr|st|sv|sy|sz|tc|td|tf|tg|th|tj|tk|tm|tn|to|tp|tr|tt|tv|tw|tz|ua|ug|uk|um|us|uy|uz|va|vc|ve|vg|vi|vn|vu|wf|ws|ye|yt|yu|za|zm|zw)'

See the code https://raw.github.com/cowboy/javascript-linkify/master/ba-linkify.js

I liked yours than the one above. But sadly I could not use it because of this issue. I will try to solve.

On Wed, Oct 31, 2012 at 4:19 AM, Jann Horn notifications@github.com wrote:

I think that it would be very hard to do that in a generic way without too many false positives. Also, something like google.com/foo already works correctly.

How would you do it?

— Reply to this email directly or view it on GitHubhttps://github.com/thejh/node-linkify/issues/2#issuecomment-9941055.

thejh commented 12 years ago

Have a look at this example:

hmm.so what about that idea?

One space omitted, and it turns into a link. Or what about libfoo.so? It's clearly a filename, but it would turn into a link.

snatesan commented 12 years ago

Good point On Oct 31, 2012 4:05 PM, "Jann Horn" notifications@github.com wrote:

Have a look at this example:

hmm.so what about that idea?

One space omitted, and it turns into a link. Or what about libfoo.so? It's clearly a filename, but it would turn into a link.

— Reply to this email directly or view it on GitHubhttps://github.com/thejh/node-linkify/issues/2#issuecomment-9965538.