Remplacer les occurences d'une variable
Résolu
angel lestat
Messages postés
233
Date d'inscription
jeudi 26 avril 2007
Statut
Membre
Dernière intervention
17 mars 2015
-
27 nov. 2010 à 01:13
angel lestat Messages postés 233 Date d'inscription jeudi 26 avril 2007 Statut Membre Dernière intervention 17 mars 2015 - 1 déc. 2010 à 00:06
angel lestat Messages postés 233 Date d'inscription jeudi 26 avril 2007 Statut Membre Dernière intervention 17 mars 2015 - 1 déc. 2010 à 00:06
A voir également:
- Remplacer les occurences d'une variable
- Remplacer disque dur par ssd - Guide
- Quel site pour remplacer coco - Accueil - Réseaux sociaux
- Remplacer word - Guide
- Remplaçant de Coco : quelles solutions pour tchater gratuitement en ligne ? - Accueil - Réseaux sociaux
- Remplacer carte graphique - Guide
2 réponses
angel lestat
Messages postés
233
Date d'inscription
jeudi 26 avril 2007
Statut
Membre
Dernière intervention
17 mars 2015
14
1 déc. 2010 à 00:06
1 déc. 2010 à 00:06
Merci, pour ceux qui le desire voici une fonction toute faite qui resout mon probleme.
function clickable_link($text) { # this functions deserves credit to the fine folks at phpbb.com $text = preg_replace('#(script|about|applet|activex|chrome):#is', "\\1:", $text); // pad it with a space so we can match things at the start of the 1st line. $ret = ' ' . $text; // matches an "xxxx://yyyy" URL at the start of a line, or after a space. // xxxx can only be alpha characters. // yyyy is anything up to the first space, newline, comma, double quote or < $ret = preg_replace("#(^|[\n ])([\w]+?://[\w\#$%&~/.\-;:=,?@\[\]+]*)#is", "\\1<a href=\"\\2\" target=\"_blank\">\\2</a>", $ret); // matches a "www|ftp.xxxx.yyyy/zzzz" kinda lazy URL thing // Must contain at least 2 dots. xxxx contains either alphanum, or "-" // zzzz is optional.. will contain everything up to the first space, newline, // comma, double quote or <. $ret = preg_replace("#(^|[\n ])((www|ftp)\.[\w\#$%&~/.\-;:=,?@\[\]+]*)#is", "\\1<a href=\"http://\\2\" target=\"_blank\">\\2</a>", $ret); // matches an email@domain type address at the start of a line, or after a space. // Note: Only the followed chars are valid; alphanums, "-", "_" and or ".". $ret = preg_replace("#(^|[\n ])([a-z0-9&\-_.]+?)@([\w\-]+\.([\w\-\.]+\.)*[\w]+)#i", "\\1<a href=\"mailto:\\2@\\3\">\\2@\\3</a>", $ret); // Remove our padding.. $ret = substr($ret, 1); return $ret; }