Actually, that doesn't help... Because I'm trying to strip it out of string that contains multiple URLSs of different types.
However, the string only contains one instance of: "jpg"
So, what I'm trying to do is more like: REGEX: "^<(http)[*?](.jpg)/si" - Try to find a string that starts with http, and ends in JPG, and doesn't contain any <'s.
But, I can't get it to work at all. I'm new to RegEX.
I can't get this to do anything other than echo ArrayArrayArrayArray.........
Code:
preg_match_all("/'http'(.+?)'jpg'/", $image, $matches);
$array = $matches[2];
echo $matches[0];
echo $matches[1];
echo $matches[2];
echo $array[0];
echo $array[1];
echo $array[2];
And, here is an actual string I'm trying to parse and image out of...
Code:
<?php
$data = "<a href=\"http://profile.myspace.com/index.cfm?fuseaction=user.viewprofile&friendid=3180342\" id=\"ctl00_Main_ctl00_UserFriends1_FriendRepeater_ctl02_friendLink\">Jeff</a><br><a href=\"http://profile.myspace.com/index.cfm?fuseaction=user.viewprofile&friendid=3180342\" id=\"ctl00_Main_ctl00_UserFriends1_FriendRepeater_ctl02_friendImageLink\"><img src=\"http://a267.ac-images.myspacecdn.com/00220/66/23/220403266_s.jpg\">" ;
$regex = '^</http(.+?)jpg/si';
preg_match($regex,$data,$match);
var_dump($match);
echo $match[1];
?>