I've been trying to learn reg expression but it's getting very very frustrating.
I'm using pregsplit to find an image url like an example below but it doesn't seem to fetch the rest "/wedding/getting_ready".
http://www.site.com/pictures/wedding/getting_ready.jpg
$pic= preg_split("/http:\/\/www.site.com/pictures/", $link); $pic= preg_split("/.jpg/", $pic[1]);
I'm getting some serious eye strains over this. Any tips would be great.
It might be simpler to use a single preg_match:
if(preg_match('#http://www.site.com/pictures(/.+)\.jpg#i', $text, $matches)) { $pic = $matches[1]; } else { // handle not found condition here }