http://stackoverflow.com
olması gerektiğini
<a href="http://stackoverflow.com">http://stackoverflow.com</a>
EDIT: orijinal dizeden çapa etiketleri sağlam kaldı eğer iyi olurdu.
John Gruber just posted an interesting regex example to capture URLs: Daring Fireball regex to get URLs
Sadede, o seçti (liberal, uzun) desen oldu:
\b(([\w-]+://?|www[.])[^\s()<>]+(?:\([\w\d]+\)|([^[:punct:]\s]|/)))
Yani aşağıdaki tüm yakalamak için bahseder:
http://foo.com/blah_blah
http://foo.com/blah_blah/
(Something like http://foo.com/blah_blah)
http://foo.com/blah_blah_(wikipedia)
(Something like http://foo.com/blah_blah_(wikipedia))
http://foo.com/blah_blah.
http://foo.com/blah_blah/.
<http://foo.com/blah_blah>
<http://foo.com/blah_blah/>
http://foo.com/blah_blah,
http://www.example.com/wpstyle/?p=364.
http://✪df.ws/123
rdar://1234
rdar:/1234
http://userid:password@example.com:8080
http://userid@example.com
http://userid@example.com:8080
http://userid:password@example.com
http://example.com:8080 x-yojimbo-item://6303E4C1-xxxx-45A6-AB9D-3A908F59AE0E
message://%3c330e7f8409726r6a4ba78dkf1fd71420c1bf6ff@mail.gmail.com%3e
http://➡.ws/䨹
www.➡.ws/䨹
<tag>http://example.com</tag>
Just a www.example.com link.
Yani preg_filter gibi bir şey ile desen kullanmak istiyorum, ve sonra bir şekilde kibrit döndürülen dizi üzerinden yineleme. Sanırım. Ben regex nefret ederim.