I have a string, inside of that I have an image:
\"balbalba
You could do this with a parser and a simple regex to check the attribute starts with required directory...
$string = 'balbalba
balbalba
balbalba
';
$doc = new DOMDocument();
$doc->loadHTML($string);
$images = $doc->getElementsByTagName('img');
foreach ($images as $image) {
if(preg_match('~^img/programacao/~', $image->getAttribute('src'))) {
echo $image->getAttribute('src') . "\n";
}
}
Output:
img/programacao/51.jpg
img/programacao/46.jpg