Link formatting à la Slashdot

Posted by the ManGeek

Wednesday, July 13th 2005 11:42 pm CDT

I've been working on developing a regular expression to match URLs in blog entries, giving someone link formatting similar to how its done on Slashdot [slashdot.org].

As you can see above, the following regular expression is what produces that [slashdot.org] which follows:

/(<a .*?href="https?:\/\/(.*?)[\/\"].*?</a>)/\1 [\2]/

Improvements and recommendations are welcome. I can note right away that this is designed to do nothing to relative URLs.

Trackback URL: http://www.mangeek.com/blogc/27track.html

Comments (0)

Add Comment

Name:
Subject:
Comment:

Note: HTML is allowed but limited to the following: <a>, <p>, <br>, <em>, <strong>, <b>, <i>, <blockquote>, <ol>, <ul>, and <li>.

 

No Comments

Posted by: ...

Monday, February 6th 2012 11:06 am CST

 

No comments on file...