Re: how to avoid double URL parsing

From: Date: Wed, 03 Jan 2001 13:38:35 +0000
Subject: Re: how to avoid double URL parsing
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-32488@lists.php.net to get a copy of this message
have a look at preg_replace, and negative look-behing assertions in the PCRE pattern syntax description. in layman's terms, you can construct a PCRE pattern that will by applied only if there's not a 'something' before a subpattern. At 14:25 3.1. 2001, indrek siitan wrote the following: -------------------------------------------------------------- >Hi, > >ok, it probably might be a dumb question, but since I'm tied up >with other things right now, I hope someone has invented that >wheel already :) > >in the function, that prepares an article body for outputting >to the page, I have the following function to make links clickable: > >$c=ereg_replace("http://(([A-Za-z0-9.\-])+)([a-zA-Z0-9])((/(([a-zA-Z0-9])*))*)(( >.([a-zA-Z0-9])+)*)", "<A TARGET=\"_blank\" >HREF=\"\\0\">\\0</A>",$c); > >now, does anyone have an idea how to extend that to handle situations >where user has its own HTML links (<a >href="http://blah">blah</a>) >inside the $c - currently, as you might expect, it screws 'em up. > > >Rgds, >Indrek > >--------------------------------------------------------------------------- >Indrek Siitan, CEO eMotion Ltd. [http://www.eMotion.ee] >e-mail: tfr@eMotion.ee Narva mnt 31, 10120 Tallinn Estonia >cellular: +372 50 17621 phone: +372 6605 890 > > >-- >PHP General Mailing List (http://www.php.net/) >To unsubscribe, e-mail: php-general-unsubscribe@lists.php.net >For additional commands, e-mail: php-general-help@lists.php.net >To contact the list administrators, e-mail: php-list-admin@lists.php.net ------end of quote------ ____________________________________________________________ Cynic: A member of a group of ancient Greek philosophers who taught that virtue constitutes happiness and that self control is the essential part of virtue. cynic@mail.cz

« previous php.general (#32488) next »