Thursday, April 12, 2012

Replace URLs in text with HTML links

Here is a design though: For example is I put a link such as

in textarea . How do I get PHP to detect it’s a http:// link and then print it as

print "<a href='htttp://'></a>";

I remember doing something like this before however, it was not fool proof it kept breaking for complex links.

Another good idea would be if you have a link such as

fix it so it does

print "<a href=''>";
print "";
print "</a>";

This one is just an after thought.. stackoverflow could also probably use this as well :D

Any Ideas

Source: Tips4all

No comments:

Post a Comment