Just do a while loop:
  
  while(preg_match("/string to find unconverted links/", $TextBody))
  {
    // preg_replace here
  }

But make sure you're not doing this on the fly every time the page is
viewed. That will take up an enormous amount of resources with lots of
visitors. Just convert it and save the converted version for viewing.

- Jonathan

-----Original Message-----
From: Kevin Won [mailto:[EMAIL PROTECTED]]
Sent: Friday, March 29, 2002 11:46 AM
To: [EMAIL PROTECTED]
Subject: [PHP-DB] help with preg_replace for http://


I'm writing a knowledgebase (basically a content management system)
application where people are adding text via web forms then viewing this
data on the web. standard bread-and-butter kind of stuff.

of course people want to put in their hyperlinks in the page w/o having to
do any sort of html coding. I'm having a hard time getting my regular
expression to work correctly to match for anything that starts with http://
and ends with a space character, extracting this as a $string, then
formatting the hyperlink as <a href="$string">$string</a> on the
knowledgebase viewing scripts.

The one I've written matches and replaces only the first instance of http://
in the string. (which solves problems as long as there is only one hyperlink
in the page ;-)

thanks

kevin





Kevin Won
-------------------------------------------------------------
ITG Web Developer,
Systems Administrator
Oregon Health Sciences University
(503) 418-4282
cell: (503) 913-5367
page: x15897
fax: (503) 494-1888





-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to