//Example of image
$image = '<img src="../img/image.jpeg" title="Title" alt="Alt"/>';
I have all this $patterns where i can take the value one at a time
// get the src for that image
$pattern_src = '/src="([^"]*)"/';
// get the title for that image
$pattern_title = '/title="([^"]*)"/';
// get the alt for that image
$pattern_alt = '/alt="([^"]*)"/';
How can i use all this $patterns with preg_replace like this:
preg_replace($pattern_src+$pattern_title+$pattern_alt,$1$2$3,$image);
Values
$1 => src value
$2 => title value
$3 => alt value;
Why i need it
<figure>
<figcaption>
$2 //Title value
</figcaption>
<img src="../web/img/$1"> //New src
<figcaption>
$3 //Alt value
</figcaption>
</figure>
src,titleandaltand use it somewhere else..right?