ゲームイーグル:
私は値を導出する方法を教えてください123.jpg
し、456.jpg
その中にある[img][/img]
、このラインからのタグ:
$str = "Text 1 [img]123.jpg[/img] Text 2 [img]456.jpg[/img]";
ウェズリー・スミス:
このような何かが動作します:
$re = '/\[img\](.*?\.jpg)\[\/img\]/m';
$str = 'Text 1 [img]123.jpg[/img] Text 2 [img]456.jpg[/img]';
preg_match_all($re, $str, $matches, PREG_SET_ORDER, 0);
foreach ($matches as $match) {
if (isset($match[1])) {
unlink($match[1]);
}
}