i need to replace all div's containig class "ta" and id "ta_somenumber" with textareas that will keep same attributes. Here is example code:
$html_content = '<div class="ta" id="ta_345">sometext</div><span style="...">Some text</span><--!more html--><div class="ta" id="ta_5687">sometext</div>';
Here is what i want to achieve:
$html_new_content = '<textarea class="ta" id="ta_345">sometext</textarea><span style="...">Some text</span><--!more html--><textarea class="ta" id="ta_5687">sometext</textarea>';
I was trying with this:
$regex1 = '#\<div class=\"ta\" id=\"(.*)\"\>(.+?)\<\/div\>#s';
$regex2 = '#\<textarea class=\"ta\" id=\"(.*)\"\>(.+?)\<\/textarea\>#s';
$result = str_replace($regex2, $regex3, $html_content);
But for some reason this doesnt work. I tried with preg_replace but no luck.