Seite 3 von 3

Verfasst: 23.03.2003 18:17
von Syco23
ja genau das mein ich. Woher kommt das, dass das Leerzeichen verschwindet, bzw. das "E" nicht angezeigt wird???

Verfasst: 23.03.2003 18:24
von saerdnaer
okay dann probier mal:

Code: Alles auswählen

function make_clickable($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("#([a-z0-9]+?){1}://([\w\-]+\.([\w\-]+\.)*[\w]+(:[0-9]+)?(/[^ \"\n\r\t<]*)?)#i", 'Es wurde versucht eine URL zu posten', $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("#(www|ftp)\.(([\w\-]+\.)*[\w]+(:[0-9]+)?(/[^ \"\n\r\t<]*)?)#i", 'Es wurde versucht eine URL zu posten', $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); 
}

Verfasst: 23.03.2003 18:30
von Syco23
was hast du denn verändert? *phpverstehenwill*

Verfasst: 23.03.2003 18:36
von saerdnaer
ich hab einfach das ([\t\r\n ]) aus dem regulären ausdruck rausgelöscht...

ah

Verfasst: 23.03.2003 18:51
von Syco23
Ok. ich werds gelich testen. eins noch: ich möchte jetzt noch <font color="red"> einfügen. Geht das, wenn ich da reguläre Anführungszeichen nehme? In der "Es wurde versucht.." Zeile is ja glaub ich nur ein einfaches Anfürhungszeichen offen..

Verfasst: 23.03.2003 18:54
von saerdnaer
du kannst entweder

Code: Alles auswählen

'<font color="red">Es wurde versucht eine URL zu posten</font>'
oder

Code: Alles auswählen

"<font color=\"red\">Es wurde versucht eine URL zu posten</font>"
folgendes geht nicht:

Code: Alles auswählen

"<font color="red">Es wurde versucht eine URL zu posten</font>"

Verfasst: 23.03.2003 19:58
von Syco23
alles klar, thanx für das mini-tut