public static function get_res_file($content) { //<img src="{@res_id=3}" $matched = preg_match('/<img\\ssrc="{@res_id=(?P<resId>\\d+)}">/', $content, $matches); if ($matched) { $res = UploadedRes::find($matches["resId"]); return $res->filename; } return null; }