On Wed, 5 Sep 2001 12:15:34 +0200 impersonator of [EMAIL PROTECTED] (*
R&Ze:) planted &I saw in php.general:

>This should do the job:
>
...
You can keep improving:) or you can use piece of my working (except for
$Harlem, to which i am not going:) code (I give it for free this time:) 

No /me, no ereg, no nothing - gentleMen:)-just /i (did you miss it, btw?:)


note1: your url shouldn't be broken in the middle by \n 
note2: you might see strange characters in patterns - its allowed by
standart - cyrilic. If you are sure to not need anything but latinic, take
others out.
--------
$pref = "([a-z0-9~#%\&=\?/\._-]+?:([a-z0-9~#%\&=\?/\._-]+?@)?)?";
$port = "(:[\d]+)?";
$domain =
"([_0-9a-z][_0-9a-z-]+?[\.])+[a-z]{2,3}";
$subpat = $domain . $port .
"([/\\][a-z0-9~#%@\&:\.=\?_-]*)*";
$patterns = array
("`(?<=[;\x20^<>{}+-=|\\&%^\^\$#!~:.,\(\)\"'\[])((f|ht)tps?|news)://" .
$pref . $subpat ."`i",
       "`(?<=[;\x20^<\(\)\"'\[])www[\.]" . $subpat . "`i",
       "`(?<=[;\x20^<\(\)\"'\[])[_\.0-9a-z-]+@" . $domain . "`i");
$links = array ("<a href='\\0'>\\0</a>",
       "<ahref='http://\\0'>\\0</a>",
       "<a href='mailto:\\0'>\\0</a>");

$Harlem=explode("\n",$mem);
foreach($Harlem as $line){
  $line = htmlspecialchars ( $line);
  $line = preg_replace ($patterns, $links, $line);
}
>-- 
>-- Renze Munnik
>-- DataLink BV
>--
>-- E: [EMAIL PROTECTED]
>-- W: +31 23 5326162
>-- F: +31 23 5322144
>-- M: +31 6 21811143
>--
>-- Stationsplein 82
>-- 2011 LM  HAARLEM
>-- Netherlands
>--
>-- http://www.datalink.nl
>-- 
--
i leonid http://nux.home.dk3.com/
no phone here, but for other personals - donation info. - visit i site^:)

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]

Reply via email to