Hi everyone !

Take a look at the source of this webpage :

http://mp3.tamilwire.com/mankatha-2011.html


So this source page has many links with it.(<a></a>)

But this page has links to 5 mp3 songs. They are :

<a target="_blank" href="http://download.tamilwire.com/songs/__K_O_By_Movies/Mankatha/Vilayadu%20Mankatha%20-%20TamilWire.com.mp3">Vilayadu Mankatha ? TamilWire.com.mp3</a> (11.1 MB)</li> <a target="_blank" href="http://download.tamilwire.com/songs/__K_O_By_Movies/Mankatha/Dia%20Dia%20Dole%20-%20TamilWire.com.mp3">Dia Dia Dole ? TamilWire.com.mp3</a> (7.4 MB)</li> <a target="_blank" href="http://download.tamilwire.com/songs/__K_O_By_Movies/Mankatha/Goa%20-%20TamilWire.com.mp3">Goa ? TamilWire.com.mp3</a> (8.4 MB)</li> <a target="_blank" href="http://download.tamilwire.com/songs/__K_O_By_Movies/Mankatha/Theeratha%20Vilaiyattu%20-%20TamilWire.com.mp3">Theeratha Vilaiyattu ? TamilWire.com.mp3</a> (8.9 MB)</li> <a target="_blank" href="http://download.tamilwire.com/songs/__K_O_By_Movies/Mankatha/Yogi%20Yogi%20Thaan%20-%20TamilWire.com.mp3">Yogi Yogi Thaan ? TamilWire.com.mp3</a> (7.0 MB)</li>


If you take a close look at these links, these links are distinct from other links in the page.

1. These are the only 5 links which have an extension ".mp3"
2. These are the only 5 links which start with "http://download" at the beginning.


So i want now is to grab these 5 links alone from this page using php code.

This can be possibly done by the " preg_match " statement.

A statement like this will select the entire links from page :

$res=file_get_contents($url);
preg_match('/<a([^>]+)\>(.*?)\<\/a\>/i',$res,$match);


What i want you to do is that , you should change the preg_match statement (i mean the regular expression in it) so that it select only the above five mp3 links from the page.

Thanks.
softleaks Reviewed by softleaks on . Help with preg_match - php ! Hi everyone ! Take a look at the source of this webpage : http://mp3.tamilwire.com/mankatha-2011.html So this source page has many links with it.(<a></a>) But this page has links to 5 mp3 songs. They are : Rating: 5