PHP-Analyse von Links / E-Mails

Ich frage mich, ob es ein einfaches Snippet gibt, das Links jeglicher Art konvertiert:

<code>http://www.cnn.com to <a href="http://www.cnn.com">http://www.cnn.com</a>
cnn.com to <a href="http://www.cnn.com">cnn.com</a>
www.cnn.com to <a href="http://www.cnn.com">www.cnn.com</a>
[email protected] to  to <a href="mailto:mailto:[email protected]">mailto:[email protected]</a>
</code>

Ich möchte keine PHP5-spezifische Bibliothek verwenden.

Vielen Dank für Ihre Zeit.

AKTUALISIEREN Ich habe den obigen Text auf das aktualisiert, in das ich ihn konvertieren möchte. Bitte beachten Sie, dass das href-Tag und der Text für die Fälle 2 und 3 unterschiedlich sind.

UPDATE2 Wie funktioniert Google Mail Chat? Ihre ist ziemlich schlau und funktioniert nur für echte Domainnamen. z.B. a.ly funktioniert aber a.cb funktioniert nicht.

Antworten auf die Frage(4)

Ihre Antwort auf die Frage