Description
This expression will capture the title of the section and the href & title of each link. I left this as a multiline expression to help with readability. The multiline regex does require the x
ignore whitespace in pattern option
<b>[\w\s]+:\s*<\/b>.*?
<a\b(?=\s)
(?=(?:[^>=]|='[^']*'|="[^"]*"|=[^'"][^\s>]*)*?\shref=('[^']*'|"[^"]*"|[^'"][^\s>]*))
(?=(?:[^>=]|='[^']*'|="[^"]*"|=[^'"][^\s>]*)*?\stitle=('[^']*'|"[^"]*"|[^'"][^\s>]*))

Expanded
<b>[\w\s]+:\s*<\/b>.*?
finds the catagory header and captures the text before the :
<a\b(?=\s)
match the open anchor tag
(?=(?:[^>=]|='[^']*'|="[^"]*"|=[^'"][^\s>]*)*?\shref=('[^']*'|"[^"]*"|[^'"][^\s>]*))
collects the href value, note the additional fluff here is to prevent odd edge cases and allows the attribute to appear in any order inside the tag
(?=(?:[^>=]|='[^']*'|="[^"]*"|=[^'"][^\s>]*)*?\stitle=('[^']*'|"[^"]*"|[^'"][^\s>]*))
collects the title value, same fluff as in the href match above
PHP Code Example:
Input Text
<div class="sms-separator"></div>
<div class="wallpaper-ads-right">
<b>Wallpaper:</b>
Rayman Legends Game sms<br />
<b>Categories: </b>
<a href="/games-desktop-wallpapers.html" title="Games wallpapers"> Games</a>
<br /><b>
<div class="sms-separator"></div>
<div class="wallpaper-ads-right">
<b>Wallpaper:</b>
Souya ssss<br />
<b>Categories: </b>
<a href="/soutss-tourguides" title="Tour"> Tourist</a><br /><b>
Code
<?php
$sourcestring="your source string";
preg_match_all('/<b>([\w\s]+):\s*<\/b>[\s\r\n]*?
<a\b(?=\s)
(?=(?:[^>=]|=\'[^\']*\'|="[^"]*"|=[^\'"][^\s>]*)*?\shref=(\'[^\']*\'|"[^"]*"|[^\'"][^\s>]*))
(?=(?:[^>=]|=\'[^\']*\'|="[^"]*"|=[^\'"][^\s>]*)*?\stitle=(\'[^\']*\'|"[^"]*"|[^\'"][^\s>]*))/imsx',$sourcestring,$matches);
echo "<pre>".print_r($matches,true);
?>
Matches
$matches Array:
(
[0] => Array
(
[0] => <b>Categories: </b>
<a
[1] => <b>Categories: </b>
<a
)
[1] => Array
(
[0] => Categories
[1] => Categories
)
[2] => Array
(
[0] => "/games-desktop-wallpapers.html"
[1] => "/soutss-tourguides"
)
[3] => Array
(
[0] => "Games wallpapers"
[1] => "Tour"
)
)