| Код | $text = 'text here';
$regexp = '#(http://.*?)/.*?currentfolder=(.*?)&.*?filename=(.*?\.[a-z]{1,4})#i';
preg_match($regexp, $text, $matches); $url = urldecode($matches[1] . $matches[2] . $matches[3]); echo $url;
|
эм.. или нужно в тексте сделать замену ссылки?
так можно:
| Код | $regexp = '#(http://.*?)/admin/.*?currentfolder=(.*?)&.*?filename=(.*?\.[a-z]{1,4})#i';
function url($matches) { return urldecode($matches[1] . 'img' . $matches[2] . $matches[3]); } $text = preg_replace_callback($regexp, 'url', $text);
|
|