OK I am trying to match html src (example would be below)
<a href="http://mydomain.com"><img src="blah.jpg">
Of course " could be ' or could be nothing at all. I dont need attributes for the tags or nothing, just need to pull what src is eq to and what href is eq too.
This is my regexp so far.
$pattern2 = "|href=[\"']?([\"' >]+)\s.src\s=\s[\"']?([\"' >]+)|i";
This sort of works ... 🙂
It returns the right information except, if there is two href tags on the same line it doesnt work right. I tried adding U to the end so it would be Ui and that just returns single characters instead of the url or image name.
Example of result below:
Array
(
[0] => Array
(
[0] => href='http://www.mydomain.net'><img src=http://www.mydomain.net/blah.jpg border=0></a></td><td align=center><a href='http://anotherdomain.com'><img src=http://www.mydomain.com/anotherpic.gif
[1] => href="test1.mpg"><img border="1" src="_test1.jpg
)
[1] => Array
(
[0] => [url]http://www.mydomain.net[/url]
[1] => test1.mpg
)
[2] => Array
(
[0] => [url]http://www.mydomain.net/blah.jpg[/url]
[1] => _test1.jpg
)
)
Notice the second url in $array[0][0] is not being parsed. It just skips it. Any help would be greatly appreciated as im still learning reg exp 🙂