Код: Выделить всё
$re = '~^\h*(https?://?\S+?\.(?:jpe?g|gif|png|tiff|svg))~m';
$str = '';
$subst = "
[img]\[/img]
";
$result = preg_replace($re, $subst, $str);
echo "The result of the substitution is ".$result;
https://regex101.com/r/QQmTKl/1Попробуйте добавить текстовое поле, чтобы получить HTML-код, но оно пустое
Код: Выделить всё
Подробнее здесь: [url]https://stackoverflow.com/questions/79359291/automatically-add-img-src-to-multiple-urls-with-regex[/url]