Bir bağlantı ayrıştırma için PHP Reg ex

0 Cevap php

Ben bir formu (mesajı) POST içeriğini ayrıştırmak ve gerçek bir HTML linki herhangi bir URL dönüşümü bir PHP komut dosyası var. Bu kullandığım 2 düzenli ifadeler:

$dbQueryList['sb_message'] = preg_replace("#(^|[\n ])([\w]+?://[^ \"\n\r\t<]*)#is", "\\1<a href=\"\\2\" target=\"_blank\">\\2</a>", $dbQueryList['sb_message']);

$dbQueryList['sb_message'] = preg_replace("#(^|[\n ])((www|ftp)\.[^ \"\t\n\r<]*)#is", "\\1<a href=\"http://\\2\" target=\"_blank\">\\2</a>", $dbQueryList['sb_message']);

Tamam iyi ama şimdi çalışıyor, başka bir komut dosyası ben tersini yapmak istiyorum. Yani benim $dbQueryList['sb_message'] Böyle bir bağlantı olabilir "<a href="http://google.com" target="_blank">Google</a>" ve ben sadece "http://google.com" istiyorum.

I cannot write the regex that can do that. Could you help me please? Thanks :)

0 Cevap