Linkify ting (exclude emails)

By JoeSimmons Last update Jun 2, 2010 — Installed 5,071 times.

How about a new regex?

in
Subscribe to How about a new regex? 2 posts, 2 voices



ekbworldwide Scriptwright
FirefoxWindows

Sometimes...

var regex = /\b(?![\@\s]+)(https?:\/\/)?([\w-]+\.)?[\w-]+\.(dk|com|net|org|se|no|nl|us|uk|de|it|nu|edu|info|co\.nr|(co\.)?in|to|fr|gov|biz|tv|co\.|mil|hu)(\/[^ ]*)?\b/gi,

...fails.

Example

stu nicholls | CSS PLaY | 100% wide/high 'background' image emulation
http://www.cssplay.co.uk/layouts/background.html

It linkifies "http://www.cssplay.co." - which is odd.

For now I'm giving up on your script since a bad regex is - well - a bad regex.

I'm going to give this script a whirl:

Text to Link
http://userscripts.org/scripts/show/7122

___________________
Edit

The advantage of your script is that it avoids certain tags - like PRE. I just learned that "Text to Link" doesn't avoid the stuff inside PRE.

 
JoeSimmons Script's Author
FirefoxWindows
First of all, the regex wasn't created by me, I only slightly edited it.

Second of all, it's because that specific domain isn't in the regex. I will add it when I have more time to dissect the regex and make it more dynamic.

Third of all, how are you to say it's a bad regex? Since when did you know a bad regex from a good regex? You learned a lot of regex from me, I can see it in your code, so if you do know bad from good, then please, make a good regex for this. If not, I will update the regex to fit that domain and upload it.

This script wasn't made by me, but I'm slowly making improvements in my free time. Remember, I have over 200 other scripts to maintain as well.

For now, I edited it to fix your specific co.uk domain problem. If you know any other un-added 2 part domains (i.e., co.uk co.nr co.in), please inform me and I will add them.
Cross
Presentational HTML allowed.
Use <code> for inline code and <pre> for code blocks. Use &lt; and &gt; for literal < and >.
We help break paragraphs and link your links.
or cancel