foxtrot
foxtrot

Reputation: 1096

Help with extracting value in a string with PHP

Anyone could tell me if it's possible in PHP to get the value "www.businessweek.com" from the following string:

[url=http://s.tt/11MXX]
[img]http://i.curate.us/img/a67f63e06f32291b79198e33de6f2d8f?offset=0&size=450&stamp=1294861758[/img]
[/url]Clipped from: [url=http://s.tt/11MXX]www.businessweek.com[/url]
([url=http://curate.us/11MXX+]share this clip[/url])

It's the curateus BB code version...I've made some testing and could also be without the "www".

Thanks in advance

Upvotes: 0

Views: 62

Answers (1)

Ish
Ish

Reputation: 29606

preg_match_all('/\[url=.*?\](.*?)\[\/url\]/i', $data, $matches); 

Demo: http://rubular.com/r/82x6TeV9bM

Upvotes: 3

Related Questions