- preg_replace: documentation ( source)
<?php
$html = '<div class="wrap">
<div class="wp-checkbox" data-value="zf">content</div>
<div class="wp-checkbox" data-value="tdp">content</div>
</div>';
$pattern = '/=\"zf\">.*?<\/div>/';
$pattern2 = '/=\"tdp\">.*?<\/div>/';
$html = preg_replace( $pattern, '="zf">new content of div</div>', $html );
$html = preg_replace( $pattern2, '="tdp">new content of another div</div>', $html );
echo $html;