私はこの文字列を持っています:
$string = '<div class="displayEmbededImage" sourcefile="http://site.com/images/myImage.jpg" style="width:200px;"><p>Some text goes here</p></div>';
sourcefile のコンテンツを選択して次のように返す正規表現が必要です。
$parern = '/<div(.*)sourcefile="([^"]+)"(.*)>(.*)<\/div>/s';
preg_replace($pattern, '<img src="$1">', $string);
それは私がこれまでに持っているものですが、まだ完全には理解していません