回答編集履歴
1
width と heightをとってなかったので修正しました。
answer
CHANGED
@@ -5,5 +5,5 @@
|
|
5
5
|
|
6
6
|
$org = '<img class="aa bb cc etc" src="https://hogehoeg.com/xxx.jpg" alt="あああ" width="xxx" height="xxx" />出典:https://xxx.yyy.com';
|
7
7
|
echo $org. "\n";
|
8
|
-
echo preg_replace('/(<img.*\/>
|
8
|
+
echo preg_replace('/(<img.*)width.*\/>(.*$)/u', '<figure>\\1/><figcaption>\\2</figcaption></figure>', $org);
|
9
9
|
```
|