RE: [PHP-GENERAL] eregi_replace question

From: Date: Tue, 27 Jun 2000 00:24:37 +0000
Subject: RE: [PHP-GENERAL] eregi_replace question
Groups: php.general 
Request: Send a blank email to php-general+get-3251@lists.php.net to get a copy of this message
> I am pulling my hair out :O) > All I am trying to to is replace everything on the page, > leaving the urls in their nice little anchor tags. > HELP!!! Sometimes it's easier to just hand-code it: // Returns an array of anchors found in the text. function getAnchors($text) { $links = array(); $as = array(); while( eregi('(<a[[:space:]]+href)',$text,$as) ){ $start = strpos($text,$as[1]); if(! eregi('(</a>)',$text,$as) ) break; $len = strpos($text,$as[1]) + strlen($as[1]) - $start; $links[] = substr($text,$start,$len); $text = substr($text,$start + $len); } return $links; } -John

« previous php.general (#3251) next »