Need regex help to replace links in a string |
[eluser]ehicks727[/eluser]
I've got a string that I need to turn properly formatted urls into anchor text. For example... Code: $string = "http://www.example.com" turns into... Code: '<a href="http://www.example.com">http://www.example.com</a>' I appreciate the help!! Thank you.
[eluser]Dyllon[/eluser]
Code: $string = "http://codeigniter.com";
[eluser]danmontgomery[/eluser]
http://ellislab.com/codeigniter/user-gui...elper.html Quote:auto_link()
[eluser]ehicks727[/eluser]
Ah, forgot about that helper. Thank you. That actually worked better (sorry Dyllon) because the regex above does not catch dashes in the url.
[eluser]sophistry[/eluser]
i fixed auto_link() a few months back. there were a lot of problems with it. this links to the second page of the discussion, but has the full code (linked onto pastebin because of EE's"loose" handling of entities (i.e., it mangled them). http://ellislab.com/forums/viewthread/95384/P15/ |
Welcome Guest, Not a member yet? Register Sign In |