You are here: Re: [PHP] Filtering URLs problem.. « PHP « IT news, forums, messages
Re: [PHP] Filtering URLs problem..

Posted by Jochem Maas on 12/20/05 15:59

Anders Norrbring wrote:
>
> I'm writing a filter/parsing function for texts entered by users, and
> I've run into a problem...
> What I'm trying to do is to parse URLs of different sorts, ftp, http,
> mms, irc etc and format them as links, that part was real easy..
>
> The hard part is when a user has already entered a complete link..
> In short:
>
> http://www.server.tld/page.html
> should be converted to:
> <a
> href='http://www.server.tld/page.html'>http://www.server.tld/page.html</a>
>
> That part works fine, but if the user enters:
>
> <a href='http://www.server.tld/page.html'>click here</a>
>
> it all becomes a mess... Can somebody please make a suggestion on this?

regular expressions - in particular a 'negative look behind' assertion.

here is a page that [trys to] explain it:
http://www.mircscripts.org/showdoc.php?type=tutorial&id=2409

google given loads of hits for 'negative look behind', hopefully you
get somewhere - me I have too little time to right now to go into
examples. good luck

 

Navigation:

[Reply to this message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация