I am am trying to get all links from a page but i would like to match specific directory/path. i am currently using the code below:
preg_match_all("/a[\s]+[^>]*?href[\s]?=[\s\"\']+(.*?)[\"\']+.*?>([^<]+|.*?)?<\/a>/is", $sPageContent, $aResults);
the above code gets all the link of the page but i need s solution that would get links from specific directory, I like to match directories/paths with /music/music/.
For example, I have these links:
https://www.example.co.uk/music/music/397/adoramus-te/
https://www.example.co.uk/music/music/3113/obsesi/
https://www.example.co.uk/music/music/2707/the-piano/
https://www.example.co.uk/music/music/2677/irreemplazable/
https://www.example.co.uk/music/music/25981/lo/
https://www.example.co.uk/music/top/1243/core/
https://www.example.co.uk/music/top/12/late/
https://www.example.co.uk/music/top/13/new/
From the links above, I want to get all links that looks like these:
https://www.example.co.uk/music/music/397/adoramus-te/
https://www.example.co.uk/music/music/3113/obsesi/
https://www.example.co.uk/music/music/2707/the-piano/
https://www.example.co.uk/music/music/2677/irreemplazable/
https://www.example.co.uk/music/music/25981/lo/
but ignore every other links