Xairro.com

regexp für URL-Erkennung

Hallo Xairro Community, ich habe da ein Problem, bzw ich benötige einen Code.

Der soll folgendes machen: Er soll aus einen String alle URLs erkennen (die müssen mit http:// anfangen) und durch <a href="... ersetzen.

hat da jemand eine Idee?


Debuggers don't remove bugs, they only show them in slow-motion.

Rating: 0 Permalink
  • Avatar
  • Nov. 20, 2007, 7:24 p.m.

Suchet und ihr werdet finden ;)

ereg_replace("[[:alpha:]]+://[^<>[:space:]]+[[:alnum:]/]","<a href="\0" target="_blank">\0</a>", $str);

Konsti

Rating: 0 Permalink
  • rotw
  • Avatar
  • Nov. 20, 2007, 8:28 p.m.

preg ist schneller :P Falls du pingelig bist, frag Tetrapus, ich kanns nämlich nicht :D

Rating: 0 Permalink
  • Konsti
  • Avatar
  • Nov. 21, 2007, 8:31 p.m.

Dann nutz halt Preg, ich habe mich noch nicht mit diesen Ausdrücken beschäftigt......

Ist Tetrapus IceLink also Martin?

Dann könnte ich den mal fragen


Schokolade?!

Rating: 0 Permalink

Jap Tetrapack äh pus hat auf einen Namenswechsel bestanden^^


Debuggers don't remove bugs, they only show them in slow-motion.

Rating: 0 Permalink
  • Konsti
  • Avatar
  • Nov. 21, 2007, 9:44 p.m.

Gut, wenn ich ihn mal im ICQ treffe, dann lass ich das mir mal von ihm erklären und ver icelinken...


Schokolade?!

Rating: 0 Permalink